private void dgvUnactive_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= -1) { string selected; selected = dgvUnactive.CurrentRow.Cells[2].Value.ToString(); AdminPins temp = null; bool flag = false; foreach (AdminPins a in OwnerStorage.ListOfAdmins) { if (a.objectId == selected) { temp = a; flag = true; } } if (flag == false) { MessageBox.Show(this, "No Admin User could be found. Please reopen the form and try again.", "No Admin Found"); } else { AddEditNewAdminForm newPin = new AddEditNewAdminForm(temp); DialogResult result = newPin.ShowDialog(); if (result == DialogResult.OK) { PopulateList(); } } } }
private void btnAddNewAdmins_Click(object sender, EventArgs e) { AddEditNewAdminForm addForm = new AddEditNewAdminForm(null); // creating new admin user DialogResult result = addForm.ShowDialog(); if (result == DialogResult.OK) { PopulateList(); } }
//This method will open the AddEditNewAdminForm with a Null as parameter. This signals to the form that a new user is being created private void btnAddNewAdmins_Click(object sender, EventArgs e) { //Creating new Admin user AddEditNewAdminForm addForm = new AddEditNewAdminForm(null); DialogResult result = addForm.ShowDialog(); //Upon returning with success, the form will reload the DataGridView with the new information if (result == DialogResult.OK) { PopulateList(); } }