C# 经典入门15章 RadioButton和CheckBox
buttonOK的代码修改:
private void button3_Click(object sender, EventArgs e) { string output; output = "Name:" + this.textBoxName.Text + "\r\n"; output += "Address:" + this.textBoxAddress.Text + "\r\n"; output += "职业:" + (string)(this.checkBox1.Checked ? "Programmer":"Not a programmer") + "\r\n"; output += "Sex:" + (string)(this.radioButton1.Checked ? "Female" : "Male") + "\r\n"; output += "年龄:" + this.textBoxAge.Text + "\r\n"; this.textBoxOutPut.Text = output; }
ButtonHelp的代码修改
private void button4_Click(object sender, EventArgs e) { string output; output = "Name=YourName\r\n"; output += "Address=Your address\r\n"; output += "programer=Check 'Programmer' if you are a programer \r\n"; output += "Sex = Choose your sex\r\n"; output += "Age=Your age"; this.textBoxOutPut.Text = output; }