public int r;
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
r = Convert.ToInt32(dataGridView1.SelectedCells[0].Value);
员工详细信息 x = new 员工详细信息();
x.ShowDialog();
}为什么双击第一个单元格会跳转到另一个页面 双击其他单元格只要是数字也会跳转呀
public int r;
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
r = Convert.ToInt32(dataGridView1.SelectedCells[0].Value);
Form2 id = new Form2();
id.ShowDialog();
}
为什么双击数字就会跳转到另一个页面 双击文字就不会跳转
晕,你双击文字,在你那段程序里Convert.ToInt32的时候就出错了。。当然弹不出id界面,你调试的时候VS应该有报错吧。。再者说,你不给弹出窗口传值,那ID取出来做什么。
还有,你写的是CellContentClick事件,这个是指双击单元格内容时才触发,我觉得不如直接CellMouseDoubleClick这种双击(或者去写那个单击)事件好用。
还有,活用这里的DataGridViewCellEventArgs e,可以轻松获取你当前点的单元格Index或者坐标值。
public int a;
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
a = Convert.ToInt32(dataGridView1.SelectedCells[0].Value);
form2 x = new form2 ();
x.bs = bs;
x.ShowDialog();
}为什么双击整型的字段能跳转到另一个页面 双击文字就不会跳转呀
你得设置dataGridView1选择整行啊
public int r;
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
r = Convert.ToInt32(dataGridView1.SelectedCells[0].Value);
员工详细信息 x = new 员工详细信息();
x.ShowDialog();
}为什么双击第一个单元格会跳转到另一个页面 双击其他单元格只要是数字也会跳转呀
public int r;
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
r = Convert.ToInt32(dataGridView1.SelectedCells[0].Value);
员工详细信息 x = new 员工详细信息();
x.ShowDialog();
}为什么双击第一个单元格会跳转到另一个页面 双击其他单元格只要是数字也会跳转呀