private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { string a = this.comboBox2.Text; this.lblName2.Text = a; if (a != "请选择") { //All.Add(list1); //All.Add(list2); //All.Add(list3); foreach (HealthCheckSet item in ite) { healthCheckset = item; lblName2.Text = item.Namee; item.CalcPrice(); label3.Text = item.Price; this.dataGridView1.DataSource = new BindingList <HealthCheckItem>(All); break; } this.dataGridView1.DataSource = new BindingList <HealthCheckItem>(All); } else if (a == "请选择") { this.lblName2.Text = null; } }
//套餐名添加按钮 private void button1_Click(object sender, EventArgs e) { HealthCheckSet ss = new HealthCheckSet(); string number = textBox1.Text; for (int i = 0; i < items.Count; i++) { ss.Name = number; //items.Add(ss); } comboBox1.Items.Add(number); }
public void UpdateSet() { foreach (HealthCheckSet item in ite) { if (txtName.Text.Trim() == item.Namee) { MessageBox.Show("已有套餐!请重新添加"); } } List <HealthCheckItem> checkitem = new List <HealthCheckItem>(); HealthCheckSet checkset = new HealthCheckSet(txtName.Text, checkitem); ite.Add(checkset); comboBox2.Items.Add(checkset.Namee); MessageBox.Show("添加成功!!!"); }
public void Bick() { comboBox1.Items.Add("请选择"); comboBox2.Items.Add("请选择"); list1 = new HealthCheckItem("身高", "检查身高多少", "5"); list2 = new HealthCheckItem("体重", "检查体重多少", "5"); list3 = new HealthCheckItem("视力", "检查视力多少", "10"); list4 = new HealthCheckItem("听力", "检查听力多少", "5"); list5 = new HealthCheckItem("肝功能", "检查肝功能多少", "60"); list6 = new HealthCheckItem("B超", "检查B超多少", "60"); list7 = new HealthCheckItem("心电图", "检查心电图多少", "50"); items.Add(list1); items.Add(list2); items.Add(list3); items.Add(list4); items.Add(list5); items.Add(list6); items.Add(list7); foreach (HealthCheckItem item in items) { comboBox1.Items.Add(item.Nameee); } //学生人学体检 All.Add(list1); All.Add(list2); All.Add(list3); healthCheckset = new HealthCheckSet("入学检测", All); ite.Add(healthCheckset); // CalcPrice(); comboBox2.Items.Add(healthCheckset.Namee); if (comboBox1.Text.Trim() == "请选择") { dataGridView1.DataSource = new BindingList <HealthCheckItem>(); } //this.bntName1.Enabled = false; }