casting a combobox selection to char

Nov 2 2011 5:20 PM
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)