private void Set() { ATINChamCongEntities context = new ATINChamCongEntities(); var lstKyHieuVang = context.spGetAllKyHieuCacLoaiVang(); dataGridView1.DataSource = lstKyHieuVang; }
private void Set() { ATINChamCongEntities context = new ATINChamCongEntities(); var lstLoaiVang = context.spGetAllKyHieuCacLoaiVang().ToList(); var lstCaLamViec = context.spGetAllCaLamViec().ToList(); comboBox1.DataSource = lstLoaiVang; comboBox2.DataSource = lstCaLamViec; comboBox1.DisplayMember = "MoTa"; comboBox1.ValueMember = "MaKyHieu"; comboBox2.DisplayMember = "MaCaLamViec"; comboBox2.ValueMember = "MaCaLamViec"; if (lstLoaiVang.Count > 0) { comboBox1.SelectedIndex = 0; } if (lstCaLamViec.Count > 0) { comboBox2.SelectedIndex = 0; } }