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
425
ValueList problem in Grid DropDownList - Unable to convert from 'System.String' to 'System.Int32'
posted

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!