private void grvUser_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } xModeUser(emModeForm.UpdateUser); _userid = clsCommon.CnvNullToInt(grvUser.Rows[e.RowIndex].Cells[colUserId.Index].Value); txtUserName.Text = clsCommon.CnvNullToString(grvUser.Rows[e.RowIndex].Cells[colUserName.Index].Value); txtPassword.Text = clsCommon.CnvNullToString(grvUser.Rows[e.RowIndex].Cells[colUserName.Index].Value); txtFullName.Text = clsCommon.CnvNullToString(grvUser.Rows[e.RowIndex].Cells[colFullName.Index].Value); txtEmail.Text = clsCommon.CnvNullToString(grvUser.Rows[e.RowIndex].Cells[colEmail.Index].Value); cboRole.SelectedIndex = clsCommon.CnvNullToInt(grvUser.Rows[e.RowIndex].Cells[colRole.Index].Value); cboRole.Enabled = _userid != clsConfig.UserLoginId; if (e.ColumnIndex == colDeleteUser.Index) { if (_userid == clsConfig.UserLoginId) { return; } if (ComfirmMsg(MSG_COMFIRM_DELETE)) { using (var objDb = new clsDBUltity()) { objDb.DeleteUserById(_userid); xModeUser(emModeForm.CreateNewUser); grvUser.DataSource = objDb.GetMUser(); grvUser.ClearSelection(); } } } }