Hi All,
We are working on this small .Net WinForms application and validates the contents of the Data grid.
During the validation process the business related rules are applied in the "RowValidating" event of the data grid, where we set the ErrorText property of the DataGridViewRow object, which displays the error icon along with the text we set so user can hover this icon to get error details.
However, when the error is set then user is unable to enter any data in any of the textbox (Either displayed on the same Form or if we open a new Form). At this stage we can open other Forms too but user cannot put any text or choose values from dropdown combo boxes. User can only able to enter input once the error of the Data Grid View is resolved (i.e. user fills the required columns etc.)
We have upload the sample code (not like the acutal application, however, the underlying concept is same). Please follow the following steps to reproduce the issue.
-
When you first run the application; you will see two icons "Products and Customer".
- Click on "Products" button and it will display the DataGrid, enter Product Name and move to next line (2nd line)
- This will display the error notification in the Row as the validation rule forces you to enter a value in the "Order %" or "Order Amount".
- At this stage; please click on the second toolbar button "Customers" which will display the "Customers" Form.
- Now if you try to click the text box then you won't be able to do this because the "Products" data grid is in error state.
- Now you cannot do anything until you fix the error of the DataGrid.
Grunting DwarfPosted Jul 21, 2023, 11:34 PM
Hi James,
You suggested to comment out the ElseIf branch, saying it was unnecessary.
However what the ElseIf condition was doing is preventing that both, % and Price, be not zero at the same time.
The rule is that at least one, and only one, of both (either % or Price) can/must be not zero.
James AxsomPosted Jul 2, 2018, 11:17 PM