Home › Forums › WinForms controls › Xceed Grid for WinForms › Xceed Grid + SmartToolbar = System.Reflection.TargetInvocationException › Reply To: Xceed Grid + SmartToolbar = System.Reflection.TargetInvocationException
Not certain if anyone did manage to replicate the error or not. I had a look into the Inner Exception and found the error may have occurred during data type conversion from string to numeric. Initially, I thought it was just my program that’s playing up. Thus, I decided to hunt for a simple program from the website. I added a button and a toolbar to the winform as usual. I included the following codes in the click event on the tool and button:
Dim mAllValid As Boolean = True ‘Variable holding the validation result
‘ Completes the insertion row data entry
If CType(Me.InsertionRow1, Xceed.Grid.InsertionRow).IsBeingEdited Then
‘ Hides the Insertion Row
Me.InsertionRow1.Visible = False
‘Validates the current data row in modification and terminates edit mode.
If TypeOf Me.GridControl1.CurrentRow Is Xceed.Grid.DataRow Then
If CType(Me.GridControl1.CurrentRow, Xceed.Grid.DataRow).IsBeingEdited Then
‘ The program failed on the following line
mAllValid = mAllValid And ValidationProvider1.Validate(CType(Me.GridControl1.CurrentRow, Xceed.Grid.DataRow), True, False)
If mAllValid Then CType(Me.GridControl1.CurrentRow, Xceed.Grid.DataRow).EndEdit()
‘ If data in grid passed all validation, the object gets saved.
Catch ex As Exception
The is very much the same as the code I used in my own proggy. After a few modifications in the data shown in the grid and a click of either the tool button or winbutton, the exact same error occurred. Based on this, I could only guess that the problem may have been caused by the Validation Provider itself. As to why it happens, I would have no idea at all.
In my program, I am using this configuration as a lookup with one column holding a unique ID key (integer) and another description field with string datatype. This should be the simplest configuration I could come up with for testing purposes.
Hopefully, this may give you some more info on the exception.
Imported from legacy forums. Posted by James (had 745 views)