private void btnAdd_Click(object sender, EventArgs e) { MessageBox.Show("Adding New Users"); u.id = u.password = null; u.role = null; u.name = null; DelegateClassForUsers.GridDelegate uDelGrid = PopulateGridView; FormUpdateUsers fuu = new FormUpdateUsers(uDelGrid, u); fuu.Visible = true; }
private void btnEdit_Click(object sender, EventArgs e) { if (this.dgvUsers.SelectedRows.Count != 1) { MessageBox.Show("Please Select a Row First"); return; } MessageBox.Show("Updating Users"); u.id = this.dgvUsers.CurrentRow.Cells["id"].Value.ToString(); u.password = this.dgvUsers.CurrentRow.Cells["password"].Value.ToString(); u.role = this.dgvUsers.CurrentRow.Cells["role"].Value.ToString(); u.name = this.dgvUsers.CurrentRow.Cells["name"].Value.ToString(); DelegateClassForUsers.GridDelegate uDelGrid = PopulateGridView; FormUpdateUsers fuu = new FormUpdateUsers(uDelGrid, u); fuu.txtID.Enabled = false; fuu.Visible = true; }