Throwing exception from RowChanging event handler

  • Thread starter Thread starter Donna
  • Start date Start date
D

Donna

I've followed the Visual Studio .Net documentation and written a
DataTable.RowChanging event handler which throws an exception if the row has
invalid data.
My exception message is displayed nicely in a message dialog and does not
allow the user to leave the row until they fix the error or cancel the edit.

The problem is that the exception is not being caught if the user leaves the
grid without first moving to another row in the grid.

Where is the exception in the RowChanging event being handled?
Can I call this from my code?

Thanks,
Donna.
 
Donna,

Try calling the EndCurrentEdit method if it has one. If not, you'll need to
get a hold of the textbox actually used for editng and call its
EndCurentEdit.
 
Back
Top