【问题标题】:Loop in CellValueChanged event in DataGridView在 DataGridView 中的 CellValueChanged 事件中循环
【发布时间】:2011-04-23 09:51:16
【问题描述】:

我正在开发一个计费应用程序。问题是我想提高计费速度,使其尽可能快速和流畅,因此为此目的使用 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 我想将新记录显示为新记录。

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

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

【问题讨论】:

标签: c# windows winforms datagridview


【解决方案1】:

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

bool suspendEventCellValueChanged;

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-01-27
  • 1970-01-01
  • 2013-06-20
  • 2016-07-17
  • 2012-11-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多