我需要实现在DataGrid的某个Cell里输入回车,然后弹出一个MessageBox显示出该Cell的内容求想知道是什么事件并具体代码

解决方案 »

  1.   

            private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    MessageBox.Show(this.dataGridView1.CurrentCell.Value.ToString());
                    e.Handled = true;
                }
            }
      

  2.   

    楼上的方法试了,但当光标放在Cell里面的时候键盘输入并不触发KeyDown事件有其他的吗
      

  3.   

    同意1楼的,没错
    你懒得按回车,就在cellcontentclick里面写了
      

  4.   

    我用的是VS2003,好像没有cellcontentclick这个事件