private void btnLevelAdd_Click(object sender, EventArgs e) { using (SkillLevelEditForm frm = new SkillLevelEditForm(skillBindingSource.Current as Skill) { sl = new SkillLevel() }) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { db.InsertSkillLevel(frm.sl); skillLevelBindingSource.DataSource = db.GetSkillLevels(skillBindingSource.Current as Skill); skillLevelBindingSource.MoveLast(); } } }
private void btnLevelEdit_Click(object sender, EventArgs e) { SkillLevel obj = skillLevelBindingSource.Current as SkillLevel; if (obj != null) { using (SkillLevelEditForm frm = new SkillLevelEditForm(skillBindingSource.Current as Skill) { sl = obj }) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { skillLevelBindingSource.EndEdit(); db.UpdateSkillLevel(obj); PopulateSkillsList(); btnEdit.Focus(); } } } }