我想在第一个行第一个单元格输入10个字符后,不按enter或者tab情况下光标自动跳至当前行下一个单元格,不知道如何实现呢?

解决方案 »

  1.   

    类似于TextBox的Text_Change事件。这样的思路看看
      

  2.   

    类似于TextBox的Text_Change事件。这样的思路看看
      

  3.   

    我用cellvaluechanged好像要tab后才起作用呀
      

  4.   

    CellValueChenge和KeyPress都不能实时响应,可以手动给cell添加一个keypress事件        private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
            {
                Control cotrol = (Control)e.Control;
                cotrol.KeyPress += new KeyPressEventHandler(SBDH_KeyPress); 
            }        private void SBDH_KeyPress(object sender, KeyPressEventArgs e) 
            {
                MessageBox.Show(((DataGridViewTextBoxEditingControl)sender).Text.ToString().Length.ToString());
            }