繁体   English   中英

在 DataGridView 中的 CellValueChanged 事件中循环

[英]Loop in CellValueChanged event in DataGridView

我正在开发一个计费应用程序。 问题是我想提高计费速度以使其尽可能快速和流畅,因此为此目的使用了 DataGridView。

是否有使用数据网格进行计费的示例程序?

我的应用程序中的问题

The problem is that when a product is selected and quantity is entered say 100 in stock sometimes 50 may be there in one batch, so I want to add 50 from other batch and I want to show the new as new record.

用户将在数量列中输入 100 我想取消它并想将其更改为 50 这里是尝试更改它时出现的问题CellValueChanged循环发生。

由于网格的值在CellValueChanged事件中发生变化,它将再次被调用,我该如何解决这个问题,或者请给我一些示例程序链接

我完成此操作的正常方法是使用名为的私有类成员变量

bool suspendEventCellValueChanged;

在我的处理程序中,只有在suspendEventCellValueChanged == false时才继续进行修改。 如果我继续,我会设置suspendEventCellValueChanged = true ,这样我就不会陷入无限循环。

暂无
暂无

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

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