private void QuanLySanPham_Load(object sender, EventArgs e) { DataTable sp = new DataTable(); DataTable cat = new DataTable(); DataTable ncc = new DataTable(); sp = BUS_SANPHAM.LoadListSP(); cat = BUS_DANHMUC.loadListCategory(); ncc = BUS_NCC.loadListNCC(); dgSP.DataSource = sp; dgSanPham.DataSource = sp; dgSearchSP.DataSource = sp; cmbDM.DataSource = cat; cmbDM.DisplayMember = "tenDM"; cmbDM.ValueMember = "maDM"; cmbNCC.DataSource = ncc; cmbNCC.DisplayMember = "tenNCC"; cmbNCC.ValueMember = "maNCC"; }
private void TabControl1_SelectedIndexChanged(object sender, EventArgs e) { DataTable sp = new DataTable(); DataTable cat = new DataTable(); DataTable ncc = new DataTable(); sp = BUS_SANPHAM.LoadListSP(); cat = BUS_DANHMUC.loadListCategory(); ncc = BUS_NCC.loadListNCC(); if (tabControl1.SelectedIndex == 0) { dgSP.DataSource = sp; cmbDM.DataSource = cat; cmbDM.DisplayMember = "tenDM"; cmbDM.ValueMember = "maDM"; cmbNCC.DataSource = ncc; cmbNCC.DisplayMember = "tenNCC"; cmbNCC.ValueMember = "maNCC"; } else if (tabControl1.SelectedIndex == 1) { dgSanPham.DataSource = sp; cmbDanhMuc.DataSource = cat; cmbDanhMuc.DisplayMember = "tenDM"; cmbDanhMuc.ValueMember = "maDM"; cmbNhaCC.DataSource = ncc; cmbNhaCC.DisplayMember = "tenNCC"; cmbNhaCC.ValueMember = "maNCC"; } else { //cmbSearch.DataSource = cat; //cmbSearch.DisplayMember = "tenDM"; // cmbSearch.ValueMember = "maDM"; } }