为了联想输入需要,要实时取得当前输入的值,用了网上很多方法,都是很麻烦的。本人试了各种事件后,发现以下方式就可以了,发代码出来给大家学习一下。
Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
'接管datagridview 的正在编辑事件,这个是很关键的代码DataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit) '实时提交改为当前输入
‘这样就可以接管当前输入的DataGridView1.CurrentCell.Value这个值,完成keypress事件 ‘DataGridView1.CurrentCell.Value '用当前改变的输入做为联想
‘例如 IF DataGridView1.CurrentCell.Value=XXXX THEH XXX
End Sub最后
以上就是炙热火最近收集整理的关于VB.NET下完美解决datagridview KeyPress 无响应问题的全部内容,更多相关VB.NET下完美解决datagridview内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复