标签:
//个人信息采集 private void button1_Click(object sender, EventArgs e) { textBox3.Text = "你好,我是 " + textBox1.Text + " ,我的性别为 " + (radioButton1.Checked ? radioButton1.Text : "") + (radioButton2.Checked ? radioButton2.Text : "") + (radioButton3.Checked ? radioButton3.Text : "") + " ,今年 " + textBox2.Text + " 岁,具有 " + comboBox1.Text + " 学位,我爱好 " + (checkBox1.Checked ? checkBox1.Text : "") + (checkBox2.Checked ? checkBox2.Text : "") + (checkBox3.Checked ? checkBox3.Text : "") + (checkBox4.Checked ? checkBox4.Text : "") + " that‘s all!"; } private void textBox2_KeyUp(object sender, KeyEventArgs e) { string a0 = textBox2.Text; int a = -1; if (!int.TryParse(a0, out a) || (a < 0 || a > 200)) { textBox3.Text = "请在年龄一格输入正确数字"; textBox2.Text = ""; e.Handled = true; } return; //采购单 private void checkBox1_CheckedChanged(object sender, EventArgs e) { button1.Enabled = comboBox1.Enabled = textBox1.Enabled = checkBox1.Checked; } private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if ((e.KeyChar < ‘0‘ || e.KeyChar > ‘9‘) && e.KeyChar != 8) { textBox1.Text = ""; e.Handled = true; } return; } private void button1_Click(object sender, EventArgs e) { listBox1.Items.Add(comboBox1.SelectedIndex==-1?"":comboBox1.SelectedItem); if(radioButton1.Checked||radioButton2.Checked) listBox1.Items.Add(radioButton1.Checked ? radioButton1.Text : radioButton2.Text); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add(""); } private void checkBox2_CheckedChanged(object sender, EventArgs e) { radioButton1.Enabled = radioButton2.Enabled = checkBox2.Checked; } private void button2_Click(object sender, EventArgs e) { listBox1.Items.Clear(); } //选课 private void button4_Click(object sender, EventArgs e) { Application.Exit(); } private void button3_Click(object sender, EventArgs e) { textBox1.Text = listBox1.Items.Count.ToString(); } private void button2_Click(object sender, EventArgs e) { listBox1.Items.Remove(listBox1.SelectedItem); button2.Enabled = Convert.ToBoolean(listBox1.Items.Count); } private void button1_Click(object sender, EventArgs e) { if (listBox1.Items.Contains(textBox2.Text)) MessageBox.Show("课程<" + textBox2.Text + ">在课程列表中已存在", "重复错误!"); else listBox1.Items.Add(textBox2.Text); textBox2.Text = ""; button2.Enabled = Convert.ToBoolean(listBox1.Items.Count); } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { textBox2.Text = listBox1.SelectedItem==null? "":listBox1.SelectedItem.ToString(); }
标签:
原文地址:http://www.cnblogs.com/2014fhj/p/4414680.html