private void smiUpdateAdmin_Click(object sender, EventArgs e) { if (this.dgvAdmin.CurrentRow.Cells["clmName"].Value.ToString().Equals("jbit")) { MessageBox.Show("超级管理员不能修改!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } frmUpdateAdmin fu = new frmUpdateAdmin(); // int UpdateIndex = this.dgvAdmin.CurrentRow.Index; fu.isLogin = false; fu.id = Convert.ToInt32(this.dgvAdmin.CurrentRow.Cells["clmId"].Value); fu.name = this.dgvAdmin.CurrentRow.Cells["clmName"].Value.ToString(); fu.pwd = this.dgvAdmin.CurrentRow.Cells["clmPwd"].Value.ToString(); fu.phone = this.dgvAdmin.CurrentRow.Cells["clmPhone"].Value.ToString(); fu.ShowDialog(); this.dgvAdmin.DataSource = DBHelper.SearchAdmin(); //this.dgvAdmin.FirstDisplayedScrollingRowIndex = UpdateIndex; //修改的行成为第一行 // this.dgvAdmin.Rows[UpdateIndex].Selected = true; //使当前行选中 //this.dgvAdmin.CurrentCell = this.dgvAdmin.Rows[UpdateIndex].Cells[0]; //使当前行处于唯一活跃状态 }
private void btnUpdatePwd_Click(object sender, EventArgs e) { frmUpdateAdmin fu = new frmUpdateAdmin(); fu.ShowDialog(); }