private void btnUserAdd_Click(object sender, EventArgs e) { this.Hide(); UserAdd ua = new UserAdd(); ua.Show(); }
private void btnUserUpdate_Click(object sender, EventArgs e) { using (ExamEntities db = new ExamEntities()) { if (dgwUsers.SelectedCells.Count > 0) { this.Hide(); User user = new User(); int selectedrowindex = dgwUsers.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = dgwUsers.Rows[selectedrowindex]; int id = Convert.ToInt32(Convert.ToString(selectedRow.Cells["Id"].Value)); user = db.Users.Where(x => x.Id == id).FirstOrDefault(); ObjectPasser.User = user; UserAdd ua = new UserAdd(); ua.Show(); } } }