Datagridview rowvalidating event example
Up Date Row or Add New Customer in the data class in this project.
The project is setup so that each build the database is copied from the project folder to the Bin\debug folder.
A caveat, if you implement each add and edit side by side we will cancel one out when issuing Accept Changes on the underlying Data Table.
To fix this one save would be used and we would use to for each loops, one for add, one for modify or one for each loop with a if statement to distinguish between add and edit and hit the appropriate method e.g.
A better method is to use a Data Grid View Check Box column.
Greetings, The code below never sets the current cell to the error location, allowing user to correct the mistake (see below), though does display the error message.
This is activated when they press tab to leave the row (Row Validating) and the next row is populated with values from Default Values Needed I was wondering where my logic and code have failed me, instead of setting the focus to the cell containing the error it moves to the next row with the default values set but the error logo and text displayed?
Many thanks, Gary try to add onclick attributes to cell attribute to cell on dataitembound that will solve your problem.
look at the view source and find what onclick attribute you have to add to table cell.