private void Add_BTN_Click(object sender, EventArgs e) { Form T = new FormAdd(); T.Owner = this; T.Show(); this.Hide(); }
private void dataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { int id; Int32.TryParse(dataGridView.Rows[e.RowIndex].Cells["Id"].Value.ToString(), out id); if (dataGridView.Columns[e.ColumnIndex].Name == "Delete") { Student_DBEntities S = new Student_DBEntities(); Student student = S.Students.FirstOrDefault(x => x.Id == id); S.Students.Remove(student); S.SaveChanges(); Form T = new FormTable(); T.Owner = this.Owner; T.Show(); this.Dispose(false); } else { Form T = new FormAdd(id); T.Owner = this; T.Show(); this.Hide(); } }