Ejemplo n.º 1
0
        private void LoadDB()
        {
            bs.DataSource = khoaBUS.DanhSach();

            gridviewkhoa.DataSource = bs;

            txtmakhoa.DataBindings.Add("Text", bs, "MaKhoa", false, DataSourceUpdateMode.Never);
            txttenkhoa.DataBindings.Add("Text", bs, "TenKhoa", false, DataSourceUpdateMode.Never);
            txtsdtkhoa.DataBindings.Add("Text", bs, "Sdt", false, DataSourceUpdateMode.Never);
            txtmailkhoa.DataBindings.Add("Text", bs, "Email", false, DataSourceUpdateMode.Never);
        }
Ejemplo n.º 2
0
        private void LoadDB()
        {
            bs.DataSource            = lopKhoaHocBUS.DanhSach();
            gridviewlopkh.DataSource = bs;

            cbbTenKhoaLopKH.DataSource    = khoaBUS.DanhSach();
            cbbTenKhoaLopKH.DisplayMember = "TenKhoa";
            cbbTenKhoaLopKH.ValueMember   = "MaKhoa";

            txtmalopkhoahoc.DataBindings.Add("Text", bs, "MaLop", false, DataSourceUpdateMode.Never);
            cbbTenKhoaLopKH.DataBindings.Add("SelectedValue", bs, "MaKhoa");
        }
Ejemplo n.º 3
0
        private void frmthongke_Load(object sender, EventArgs e)
        {
            ds   = new DataSet();
            dt_K = new DataTable();
            dt_L = new DataTable();
            dt_S = new DataTable();

            dt_K           = khoaBUS.DanhSach().Copy();
            dt_K.TableName = "KHOA";
            dt_L           = lopKhoaHocBUS.DanhSach().Copy();
            dt_L.TableName = "LOP";

            ds.Tables.Add(dt_K);
            ds.Tables.Add(dt_L);

            ds.Relations.Add("K_L", ds.Tables["KHOA"].Columns["MaKhoa"], ds.Tables["LOP"].Columns["MaKhoa"]);

            bsKhoa = new BindingSource(ds, "KHOA");
            bsLop  = new BindingSource(bsKhoa, "K_L");

            cbbKhoa.DataSource    = bsKhoa;
            cbbKhoa.DisplayMember = "TenKhoa";
            cbbKhoa.ValueMember   = "MaKhoa";

            cbbLop.DataSource    = bsLop;
            cbbLop.DisplayMember = "MaLop";
            cbbLop.ValueMember   = "MaLop";
        }