Home Forums WinForms controls Xceed Grid for WinForms insertionrow.endedit does not add data to datarows

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15217 |

    I had this problem a couple of weeks ago, and thought I had solved it by adding auto-increment to the key field in the grid, but for one out of five basically identical forms in my program I am still having this problem:

    I set several fields via code with default values as the form is launched. When .endedit is called on the insertion row, the data disappears. Existing rows in the database still appear as datarows, but anything added via the insertion row vanishes when either .endedit is called in code, the user clicks away from the insertion row, or presses the enter key. I have tried trapping teh keydown event both for the grid and for the form, and somehow the enter key down is never captured.

    What could cause this behavior?

    Imported from legacy forums. Posted by Phil (had 3099 views)

    User (Old forums)
    Member
    Post count: 23064

    I had this before, but it was caused by the validation code of the underlying DataTable that threw an exception. If the GridControl is trying to add the newly created row to the underlying DataTable, it throws an exception if the row contains invalid data, and the row just doesn’t get added. To see if this is the problem, you could check the Output-window in Visual Studio. If it contains lines that say something like “A first chance exception of type ‘System.Data.SomeException’ occured in …”, you know that’s the problem.

    Imported from legacy forums. Posted by Tommy (had 342 views)

    User (Old forums)
    Member
    Post count: 23064

    This is happening before the data would get sent to the database. Nothing in the output window. The insertion row gets cleared, but a datarow is never created.

    Imported from legacy forums. Posted by Phil (had 464 views)

    User (Old forums)
    Member
    Post count: 23064

    The solution:

    After unchecking “enable just my code” in Tools Menu -> Options -> Debugging -> General I found the issue – a checkbox in the grid not checked or unchecked while the datbase did not allow nulls for that field.

    Thanks to Andre for the ‘”enable just my code” tip – I will try that first from now on when things don’t work but don’t error.

    Imported from legacy forums. Posted by Phil (had 3921 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.