在vs的项目中修改一下代码就无法运行了
毕业设计
1
正常能运行的画面是:
修改代码前
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Message.Text = textBoxName.Text + " 您好!!!!";
if (radioButton1.Checked) Message.Text += "\n您的性别是: " + radioButton1.Text;
else if (radioButton2.Checked) Message.Text += "\n您的性别是: " + radioButton2.Text;
Message.Text += "\n您的爱好是: ";
if (checkBox1.Checked) Message.Text += checkBox1.Text + " ";
if (checkBox2.Checked) Message.Text += checkBox2.Text + " ";
if (checkBox3.Checked) Message.Text += checkBox3.Text + " ";
if (checkBox4.Checked) Message.Text += checkBox4.Text + " ";
if ((!checkBox1.Checked) && (!checkBox2.Checked) && (!checkBox3.Checked) && (!checkBox4.Checked))
Message.Text += "\n您居然没有兴趣爱好!";
}
}
}
修改代码后: Message.Text = textBoxName.Text + " 您好123456!"; 然后就运行不起来了 提示:生成失败。
但是没有在哪提示有错误
-
你把我这段直接复制回去看看好不好用
{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Message.Text = textBoxName.Text + " 您好123456!"; if (radioButton1.Checked) Message.Text += "\n您的性别是: " + radioButton1.Text; else if (radioButton2.Checked) Message.Text += "\n您的性别是: " + radioButton2.Text; Message.Text += "\n您的爱好是: "; if (checkBox1.Checked) Message.Text += checkBox1.Text + " "; if (checkBox2.Checked) Message.Text += checkBox2.Text + " "; if (checkBox3.Checked) Message.Text += checkBox3.Text + " "; if (checkBox4.Checked) Message.Text += checkBox4.Text + " "; if ((!checkBox1.Checked) && (!checkBox2.Checked) && (!checkBox3.Checked) && (!checkBox4.Checked)) Message.Text += "\n您居然没有兴趣爱好!"; } } }
发表回复