private void loadClass() { readFileClass(); if (listClass.Count <= 0) { frmAddClass frm = new frmAddClass(listClass.Count); if (frm.ShowDialog() == DialogResult.OK) { listClass.Add(new ClassTKB { ID = frm.ClassName, DisplayClass = frm.ClassName, Active = true }); indexClassActive++; } frm.Dispose(); writeFileClass(); cbbClass.Properties.DataSource = listClass; } else { cbbClass.Properties.DataSource = listClass; } cbbClass.Properties.DisplayMember = "DisplayClass"; cbbClass.Properties.ValueMember = "ID"; cbbClass.ItemIndex = indexClassActive; }
private void pictureBox1_Click(object sender, EventArgs e) { frmAddClass frm = new frmAddClass(listClass.Count); if (frm.ShowDialog() == DialogResult.OK) { listClass.Add(new ClassTKB { ID = frm.ClassName, DisplayClass = frm.ClassName, Active = false }); indexClassActive = listClass.Count - 1; } frm.Dispose(); writeFileClass(); cbbClass.Properties.DataSource = listClass; }