private void MonHoc_Load(object sender, EventArgs e) { HSB.Loadkl(); HSB.loadnohk(); HSB.loadBCM(); List <string> l = new List <string>(); foreach (var s in clasDTO.lop) { l.Add(s.TenL1); } dslopcbox.DataSource = l.ToList(); hkcombo.SelectedItem = null; bool i = HSB.Checkhk(); if (i == true) { panel1.Visible = true; label1.Visible = false; button1.Visible = false; namhoc.Visible = false; label1.Visible = false; label2.Visible = false; label3.Visible = false; hkcombo.Visible = false; } List <string> NH = new List <string>(); foreach (var s in HocKi.HK) { int k = 1; string x = s.MaHK1.ToString(); char[] ar = x.ToCharArray(); string nam = ar[1].ToString() + ar[2].ToString() + ar[3].ToString() + ar[4].ToString(); for (int o = 0; o < NH.Count(); o++) { if (nam == NH[o]) { k = 0; } } if (k == 1) { NH.Add(nam); } } namhoccombo.DataSource = NH.ToList(); yearcombo.DataSource = NH.ToList(); foreach (var s in CTMonHoc.noneHK) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCell cell = new DataGridViewTextBoxCell(); cell.Value = s.MaMon1; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.TenMon1; row.Cells.Add(cell); mhnothkgrid.Rows.Add(row); } }