DataGridView formatting breaks validation
-
I've got a bound DataGridView that performs some validation exactly as I want it to - providing I don't have the columns formatted. A code snippet example of the validation that works when I don't format the columns is:
If CType(e.ProposedValue, Integer) <= intPreviousToValue Then e.Row.RowError = "Error message" e.Row.SetColumnError(e.Column, "Error message") End If
Using the standard VB.NET 2005 Express formatting properties, the columns are formatted to be: Column 0 - Numeric - no decimals Column 1 - Numeric - no decimals Column 2 - Currency - two decimals If I take the formatting out, the grid validation works fine - if I put the formatting back in, I can't get the validation to work. What am I breaking by putting the formatting in? -
I've got a bound DataGridView that performs some validation exactly as I want it to - providing I don't have the columns formatted. A code snippet example of the validation that works when I don't format the columns is:
If CType(e.ProposedValue, Integer) <= intPreviousToValue Then e.Row.RowError = "Error message" e.Row.SetColumnError(e.Column, "Error message") End If
Using the standard VB.NET 2005 Express formatting properties, the columns are formatted to be: Column 0 - Numeric - no decimals Column 1 - Numeric - no decimals Column 2 - Currency - two decimals If I take the formatting out, the grid validation works fine - if I put the formatting back in, I can't get the validation to work. What am I breaking by putting the formatting in?Anybody got any thoughts on this? One thing I forgot to say is that if I put a msgbox in place, when the conditions are met, it show the message - its just the errorprovider notification icon that I can't get.