Пример #1
0
        void NapLop()
        {
            DataTable dt = new DataTable();

            bus = new BUS_Diem();

            dt = bus.showdata_Lop();

            var item = new Dictionary <string, string>();

            foreach (DataRow dr in dt.Rows)
            {
                item.Add(dr["MaL"].ToString(), dr["MaL"].ToString() + " - " + dr["TenL"].ToString());
            }
            cbMaL.DataSource    = new BindingSource(item, null);
            cbMaL.DisplayMember = "Value";
            cbMaL.ValueMember   = "Key";
        }