110,538
社区成员
发帖
与我相关
我的任务
分享
#region DataGridView单击事件
/// <summary>
/// DataGridView单击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dgvStuInfo_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
int id = Convert.ToInt32(dgvStuInfo.CurrentRow.Cells[0].Value);
StudentManage stuser = new StudentManage();
stu = stuser.GetStuInfoEXById(id);
if (stu == null)
{
MessageBox.Show("获取信息失败!");
return;
}
this.txtAddress.Text = stu.Address;
this.txtCard.Text = stu.IdentityCard;
this.txtEmail.Text = stu.Email;
this.txtUpName.Text = stu.StudentName;
this.txtPhone.Text = stu.Phone;
this.txtPwd.Text = stu.LoginPwd;
if (stu.Gender == "男")
{
rbtnWan.Checked = true;
}
else if (stu.Gender == "女")
{
rbtnWoman.Checked = true;
}
lblNo.Text = stu.StudentNo.ToString();
dtoTime.Value = stu.BornDate;
}
#endregion
给你我以前的代码参考一下