public void Tram_CbbTramDen(ComboBox cbb1, ComboBox cbb2) { DAO_Tram daTram = new DAO_Tram(); int maTram = daTram.Find_IDTramByName(cbb2.SelectedValue.ToString()); cbb1.DataSource = daTram.Fill_CBBTramDenVe(maTram); cbb1.DisplayMember = "TenTram"; cbb1.ValueMember = "TenTram"; if (cbb1.Items.Count > 0) { cbb1.SelectedIndex = 0; } }
public void Tuyen_FillDGV(ComboBox cbb, DataGridView dgv) { DAO_Tuyen daTuyen = new DAO_Tuyen(); DAO_Tram daTram = new DAO_Tram(); string tenTram = ""; if (cbb.Items.Count > 0) { tenTram = cbb.SelectedValue.ToString(); } int ID_Tram1 = Convert.ToInt32(daTram.Find_IDTramByName(tenTram)); dgv.DataSource = daTuyen.Fill_TuyenXe(ID_Tram1); }