老是报错,我想问一下如果radioButton1.Checked
就messagebox.show("1")如果radioButton2.Checked
就messagebox.show("2")radioButton1,radioButton2都没有选
就messagebox.show("3")怎样用
if
if
else
的方法写出来?
就messagebox.show("1")如果radioButton2.Checked
就messagebox.show("2")radioButton1,radioButton2都没有选
就messagebox.show("3")怎样用
if
if
else
的方法写出来?
就messagebox.show("1") 如果radioButton2.Checked
就messagebox.show("2") radioButton1,radioButton2都没有选
就messagebox.show("3")
------------------------------
if(radioButton1.Checked)
MessageBox.Show("1");else if(radioButton2.Checked)
MessageBox.Show("2") ;else MessageBox.Show("3");
用如下格式:if()
...;
else if()
...;
else
...;省略内容自填
if(radioButton1.Checked)
messagebox.show("1");else if (radioButton2.Checked)
messagebox.show("2");
else
messagebox.show("3");
FileStream fs = new FileStream(@"c:\off.bat", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.GetEncoding("GB2312"));
sw.Flush();
sw.BaseStream.Seek(0, SeekOrigin.Begin);
sw.Write("@echo off\r\nshutdown -s -t 2\r\ndel %0");
sw.Flush();
sw.Close();
System.Diagnostics.Process.Start("c:\\off.bat");
else if (radioButton3.Checked)
IntPtr jb=GetActiveWindows();
else
MessageBox.Show("请选择骚扰方式!");
说FileStream和IntPtr:嵌入的语句不能是声名和标记的语句else if的else说是无效的表达式项
{
FileStream fs = new FileStream(@"c:\off.bat", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.GetEncoding("GB2312"));
sw.Flush();
sw.BaseStream.Seek(0, SeekOrigin.Begin);
sw.Write("@echo off\r\nshutdown -s -t 2\r\ndel %0");
sw.Flush();
sw.Close();
System.Diagnostics.Process.Start("c:\\off.bat");
} else if (radioButton3.Checked)
IntPtr jb=GetActiveWindows();
else
MessageBox.Show("请选择骚扰方式!");