Reputation: 4129
I am developing a billing application. The problem is that I want to increase the speed of billing to be as fast and smooth as possible so am using a DataGridView for this purpose.
Is there any example program using datagrid for billing?
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.
User will enter 100 in quantity column I want to cancel it and want to change it to 50
here is the problem when trying to change it looping occurs in CellValueChanged
.
Since value of grid is changing in CellValueChanged
event it will be called again how can I solve this or please give me some sample program links
Upvotes: 0
Views: 2539
Reputation: 36573
The normal way I accomplish this is with a private class member variable called
bool suspendEventCellValueChanged;
And in my handler, only proceed to make modifications if suspendEventCellValueChanged == false
. If I proceed, I set suspendEventCellValueChanged = true
, so that I don't get caught in an infinite loop.
Upvotes: 2