private void btnAddStudent_Click(object sender, EventArgs e) { StudentInfoDialog sid = new StudentInfoDialog(_db, StudentInfoDialog.DialogType.Add, new string[0]) { TopLevel = false, Dock = DockStyle.Fill }; sid.FormClosed += StudentForm_Closed; Hide(); Parent.Controls.Add(sid); sid.Show(); }
private void btnEditStudent_Click(object sender, EventArgs e) { string[] values = new string[lvwList.Columns.Count]; ListViewItem item = lvwList.SelectedItems[0]; for (int i = 0; i < item.SubItems.Count; i++) { values[i] = item.SubItems[i].Text; } StudentInfoDialog sid = new StudentInfoDialog(_db, StudentInfoDialog.DialogType.Edit, values) { TopLevel = false, Dock = DockStyle.Fill }; sid.FormClosed += StudentForm_Closed; Hide(); Parent.Controls.Add(sid); sid.Show(); }