datagridview 数据处理方法 修改 删除 添加 下拉类表 弹出窗口
frm.Controls["USER_NAME_TB"].Text = user_name;
frm.Controls["USER_SEX_TB"].Text = user_sex;
frm.ShowDialog(); //显示子窗口
//给输出参数赋值默认值
outUserid = user_id;
outUserpassword = user_password;
outUserclass = user_class;
outUsername = user_name;
outUsersex = user_sex;
//判断是否进行修改数据
myresult = frm.DialogResult;
if(myresult==DialogResult.OK)
{
//outUserid= frm.Controls["ID_TB"].Text;
outUserid= frm.Controls["USER_ID_TB"].Text ;
outUserpassword= frm.Controls["USER_PWD_TB"].Text ;
outUserclass= frm.Controls["USER_CLASS_CB"].Text ;
outUsername= frm.Controls["USER_NAME_TB"].Text ;
outUsersex= frm.Controls["USER_SEX_TB"].Text;
MessageBox.Show("修改了数据");
}
else
{
MessageBox.Show("没有修改数据!!");
}
frm.Dispose();
}
int selectrowindex = -1;
private void button2_Click(object sender, EventArgs e)
{
if(selectrowindex<0)
{
MessageBox.Show("请先选择一条记录数据!!");
return;