I have databinding for my comboboxes set up like this: Show Enum Description Instead of Name
When I am trying to pull the data however, I can’t just get the state code, such as IA. I get this long string like: { Value = IA, Description = Iowa }
When I pause the code and look at the combo box values, I am able to do stuff like State.SelectionBoxItem.Value That is an option that expands from the popup menu when you hover over the variable. I can’t seem to ever just grab that value programatically though.
Is it a “feature” of visual studio to allow me to break that list down like that?
Is that a string that I will have to break down programatically?
My guess would be you are looking at SelectedItem property not SelectedValue. The string { Value = IA, Description = Iowa } is result of invocation of ToString method of an anonymous type, so yes it is a feature.
In code form another question SelectedValuePath property is not set to Value, which is required to get state code of ListBox selected item through SelectedValue property.