I have ComboBox with а few items. Default returned type of item's value - String. I would like to know how can I get 'Int' type of value of selected item in ComboBox.
Explicit conversion produces an error: Specified cast is not valid.
You can use int.Parse(box.SelectedValue). If it gives you an error, it means that the value is not an integer. In that case, it may be that the value is empty, and only the text is set.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more