首页 > 代码库 > combobox联动

combobox联动

 
 1  private void w_day_scheduling_Load(object sender, EventArgs e)
 2         {
 3            
 4             if (ls_deptname == string.Empty)
 5             {
 6                 ds = DoctorService.getDdept();
 7                 comboBoxEx1.DataSource = ds.Tables[0];
 8                 comboBoxEx1.DisplayMember = "group_name";
 9                 comboBoxEx1.SelectedIndex = 0;
10                 comboBoxEx1.ValueMember = "group_code";
11                 ds.Dispose();
12             }
13         }
View Code
 1  private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
 2         {
 3             if (comboBoxEx1.SelectedIndex > -1)
 4             {
 5                 DataRowView drv = (DataRowView)comboBoxEx1.SelectedItem;
 6                 string  ls_deptcode = drv.Row["group_code"].ToString();
 7                 ds = DoctorService.getNoClass(ls_deptcode);
 8                 comboBoxEx2.DataSource = ds.Tables[0];
 9                 comboBoxEx2.DisplayMember = "CLINIC_LABEL";
10             }
11         }
View Code