Home Forums WinForms controls Xceed Grid for WinForms Updating data to data source automatically. Reply To: Updating data to data source automatically.

User (Old forums)
Member
Post count: 23064

Well Well. After a bit coding and something that looks like “try by error method” and a little bit thinking I found a solution or perhaps at better term is “some kind of workaround” 🙁

In my row validation event I placed the following code:

e.CancelEdit = false;

if(!(e.Exception is Xceed.Grid.GridException || e.Exception is System.Reflection.TargetInvocationException))
MessageBox.Show(e.Exception.Message);

if(e.Exception is System.Reflection.TargetInvocationException)
MessageBox.Show(e.Exception.InnerException.Message);

But wheeeee I’m not happy about it!!!!!!!

Is there somebody who can explain why the exception throw by the data source e.g. when a text exceeds its maximum length is placed in a Target Invocation Exception. This only happens when I’m committing my data source to the database in the RowEndingEdit event (notice previous post).

And could anybody please explain the consequences surrounding the above work around?

Imported from legacy forums. Posted by Forest (had 501 views)