Home > DeveloperSection > Forums > Get combobox set value as string
Samuel Fernandes
Samuel Fernandes

Total Post:156

Points:1096
Posted on    February-09-2014 11:20 PM

 C# C# 
Ratings:


 1 Reply(s)
 1102  View(s)
Rate this:

Found several ways to do so, but none of them works for me.. I have a combobox with variable number of options (taken from dynamic xml file). For next, I need to know what the user choosed, and I cant find out how to do it. This is one of ways I found and tried:

string myString = myCombobox.SelectedValue.ToString();

At least I dont get an error, but when I try to show that string, it does nothing.



Pravesh Singh

Total Post:411

Points:2881
Posted on    February-09-2014 11:46 PM

Hi Samuel,

Try this:

string myString = ((ComboBoxItem)myCombobox.SelectedItem).Content.ToString();


Don't want to miss updates? Please click the below button!

Follow MindStick