7
Answers

casting a combobox selection to char

Sutton Mehaffey

Sutton Mehaffey

13y
2.2k
1
I have a Combobox named "CB_x" defined in WPF and I have selections "0,5,10,15,20".  What method can I use to achieve the following (which doesn't work)?

char x;

x = (char)CB_x.SelectionBoxItem;    // item selected is a string "20", I need a char 20.

It compiles, but gives a casting error.  Is there to atoi() method somewhere?
Answers (7)