Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
520
Input string was not in a correct format error on cell edit
posted

I have an UltraGrid on an MDI child form that I am dynamically binding to a DataTable. The DataTable has a string column and a double column.  When I edit a double cell, blank out it's value and tab out of it, the program crashes with error "Input string was not in a correct format".

I have tried running in debug mode with 'break on exceptions', however, it isn't breaking on any line in my code. The funny thing is that it won't enter my BeforeCellDeactivate handler.  

I am running v10.3. I can't seem to reproduce this behavior on a test project. It only happens in my app. 
I can't figure out why. Yet, why would the BeforeCellDeactivate handler not fire on my app when I enter an invalid value in the cell?  It does fire when I enter a valid number.

I know it's not a data problem, since my test app binds to the exact same DataTable and has no issues when I enter invalid values.

 

 

  • 469350
    Verified Answer
    Offline posted

    Hi,

    There are two possibilities I can think of here.

    1) This is a FirstChanceException. In other words, it's an exception that is being raised internally to the grid and it's being caught and handled. So you are only seeing this because you have set the visual studio IDE to break on all run-time exceptions.

    cs31415 said:
    Yet, why would the BeforeCellDeactivate handler not fire on my app when I enter an invalid value in the cell?

    If it's a FirstChanceException, as I suspect, then the exception will occur before the BeforeCellDeactivate event. The event will fire, but only if you choose to continue execution after the exception. I suspect you are probably just stopping the app at that point, instead of continuing.

    2) Your data source does not allow nulls in this column. You should see if the CellDataError event of the grid is firing.