We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Use Enumeration as Cell Value Type?

Is it possible to use an Enum as the value type for a cell? In particular, the cells I need this for are all comboboxes. I put the name of my enum (TypeEnum) under CellValueType for the corresponding base style, which seemed to work OK, but when I use dataGrid[row,col].CellValue, it returns an object and throws an invalid cast message when I try (TypeEnum) dataGrid[row,col].CellValue Where to, Gumshoe? ------ LSMFT

4 Replies

ML Mary Livingstone July 7, 2005 06:33 PM UTC

Actually, Jack meant "unable to convert" error, instead of just "bad cast". Probably same difference but hey. Jack''s too cheap to post again, so I had to do it. He didn''t want to have to tip the computer (that''s a PCMCIA rack, not a coin slot!)


MC Martin Cyr July 7, 2005 06:43 PM UTC

Check out System.Enum.GetNames. It returns an array of strings wich you can then use as DataSource.


MC Martin Cyr July 7, 2005 06:47 PM UTC

I''m sorry, I misread your post, what you want in the situation might be more like System.Enum.Parse or .GetValues Sorry


AD Administrator Syncfusion Team July 7, 2005 10:12 PM UTC

Here is a sample using Enums in a combobox without this casting problem. You can also type the enum text into the cell as well. Do you need something different? http://www.syncfusion.com/Support/user/uploads/GC_CustomObject_728fd939.zip

Loader.
Live Chat Icon For mobile
Up arrow icon