繁体   English   中英

vbnet datagridview中的单元格值更改事件错误

[英]error on cell value change event in vbnet datagridview

我只是添加了消息框,当我运行表单时,消息框一直弹出,直到所有行都已加载到gridview中。

我最初的计划是显示一条消息,说明您已编辑单元格。 当加载gridview并从数据库中提取行时,或者更改单元格的值时,单元格更改事件也会发生。 如何阻止消息框弹出无数次,以及我是否使用了错误的事件? 以下正是我所做的。 我也在使用数据源从数据库中获取记录

Private Sub grdDataGrid_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles grdDataGrid.CellValueChanged


    MsgBox("You have edited the follwing cell")


End Sub

要阻止messageBox弹出无数次:

Private Sub grdDataGrid_DataBindingComplete(sender As Object, e As System.Windows.Forms.DataGridViewBindingCompleteEventArgs) Handles grdDataGrid.DataBindingComplete

MessageBox("your message")

End Sub

当使用_CellValueChanged事件时,呈现gridView时将更改所有正在加载数据的单元格。 因此,每个单元格都会触发_CellValueChanged事件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM