private void khoasv_SelectedValueChanged(object sender, EventArgs e) { //MessageBox.Show(((KeyValuePair<string, string>)khoa.SelectedItem).Value.ToString()); if (khoasv.SelectedItem != null) { Lop lop = new Lop(); // MessageBox.Show( ((KeyValuePair<string, string>)khoasv).Value.ToString()); try { for (int i = 0; i < lop.listlop_khoa(((KeyValuePair <string, string>)khoasv.SelectedItem).Value).Count; i++) { // khoa.Items.Add(new KeyValuePair<string, string>(kh.listkhoa()[i].Tenkhoa, kh.listkhoa()[i].Makhoa)); cmbLop.Items.Add(new KeyValuePair <string, string>(lop.listlop_khoa(((KeyValuePair <string, string>)khoasv.SelectedItem).Value.ToString())[i].Malop, lop.listlop_khoa(((KeyValuePair <string, string>)khoasv.SelectedItem).Value.ToString())[i].Malop)); } cmbLop.DisplayMember = "Key"; cmbLop.ValueMember = "Value"; } catch { }; } }
private void khoa_SelectedValueChanged_1(object sender, EventArgs e) { string makhoa; Lop lop = new Lop(); List <Lop> loplist = new List <Lop>(); lophoc.Items.Clear();//xoa lop moi khi chon khoa khac if (khoa.SelectedIndex != -1) { makhoa = ((KeyValuePair <string, string>)khoa.SelectedItem).Value.ToString(); loplist = lop.listlop_khoa(makhoa); for (int i = 0; i < loplist.Count; i++) { lophoc.Items.Add(new KeyValuePair <string, string> (loplist[i].Tenlop, loplist[i].Malop)); } lophoc.DisplayMember = "Key"; lophoc.ValueMember = "Value"; } }
private void khoa_SelectedValueChanged_1(object sender, EventArgs e) { string makhoa; Lop lop = new Lop(); List<Lop> loplist = new List<Lop>(); lophoc.Items.Clear();//xoa lop moi khi chon khoa khac if (khoa.SelectedIndex != -1) { makhoa = ((KeyValuePair<string, string>)khoa.SelectedItem).Value.ToString(); loplist = lop.listlop_khoa(makhoa); for (int i = 0; i < loplist.Count; i++) { lophoc.Items.Add(new KeyValuePair<string, string> (loplist[i].Tenlop, loplist[i].Malop)); } lophoc.DisplayMember = "Key"; lophoc.ValueMember = "Value"; } }
private void khoasv_SelectedValueChanged(object sender, EventArgs e) { //MessageBox.Show(((KeyValuePair<string, string>)khoa.SelectedItem).Value.ToString()); if (khoasv.SelectedItem != null) { Lop lop = new Lop(); // MessageBox.Show( ((KeyValuePair<string, string>)khoasv).Value.ToString()); try { for (int i = 0; i < lop.listlop_khoa(((KeyValuePair<string, string>)khoasv.SelectedItem).Value).Count; i++) { // khoa.Items.Add(new KeyValuePair<string, string>(kh.listkhoa()[i].Tenkhoa, kh.listkhoa()[i].Makhoa)); cmbLop.Items.Add(new KeyValuePair<string, string>(lop.listlop_khoa(((KeyValuePair<string, string>)khoasv.SelectedItem).Value.ToString())[i].Malop, lop.listlop_khoa(((KeyValuePair<string, string>)khoasv.SelectedItem).Value.ToString())[i].Malop)); } cmbLop.DisplayMember = "Key"; cmbLop.ValueMember = "Value"; } catch { }; } }