Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
If Me.DataGridView1.IsCurrentCellDirty Then
Me.DataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit)
End If
End Sub
判断没有提交的进行提交数据源与视图实时更新!!
主要就是CheckBox点击后,DataGridView的数据源随时更新!

本文介绍了一种使用Visual Basic .NET中DataGridView控件时确保数据源与视图实时更新的方法。通过监听CurrentCellDirtyStateChanged事件并调用CommitEdit方法,可以实现在用户更改单元格后立即更新数据源的功能。特别关注了CheckBox的实时更新问题。
1555

被折叠的 条评论
为什么被折叠?



