Banging my head against the wall on this one - I have to be missing something obvious but cannot see it.
I'm using ValueList on two columns in a UltraWinGrid with the Column Style set to DropDownList. The bound table for these columns/fields is Int32. I am creating the value list from an enumeration, but have also tried a simple ValueList.Add(1,"Some Item Description") and get the same results. Any time I select an item from the list it gives me the error "Unable to convert from 'System.String' to 'System.Int32'". It appears to think that the DropDownList data is string instead of integer. I've tried explicitly declaring as int by using ValueList.Add(CInt(myvalue),"Some Text...") but this doesn't work either. If I change the bound table column data type to string then the e.Cell.Value (on AfterCellUpdate) gives me the list display value. So it appears that it's binding to the display/text value rather than to the integer value, but I'm not sure where to change this (I did find the ValueList.DisplayStyle property and set it to "DisplayText") but this hasn't had any effect.
I'm sure this is something simple that I've been starting at too long to see!
Hello,
I tried this scenario with default settings on the WinGrid and ValueList, please take a look at my sample. If you want, you could send me a sample of your own which reproduces the issue.
As suspected, it was something that I was overlooking in my code. In the CellChange event the SetValue method was being called (I believe to force immediate update of the underlying data) and was passing in cell.Text. This was causing the conflict where it was constantly trying to assign a string value to int32. I had put breaks in the code, but had missed the CellChange Event because it wasn't grouped with the others in the code. I apologize for wasting your time on this as it was totally my error. I had wasted an embarrasing amount of time trying to locate the problem so I thought I must have been missing some key property so turned to you to shed some light.