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?
Loading

VulpesRank #55 · 29.2K reputationPosted Nov 2, 2011, 2:30 PM EDT
Sutton Mehaffey19 reputationPosted Nov 3, 2011, 7:40 AM EDT
When I read a char 20 from a file, how can I read that into the ComboBox?
x = 20;
CB_x.SelectionBoxItem = x.ToString(); // doesn't work
VulpesRank #55 · 29.2K reputationPosted Nov 3, 2011, 7:43 AM EDT
Sutton Mehaffey19 reputationPosted Nov 3, 2011, 8:39 AM EDT
int x;
x = (int)GlobalVars.User_Parameters.alarm_holdoff; // alarm_holdoff is a char
CBAlarmHoldoff.SelectionBoxItem = x.ToString;
I was trying to do it this way too.
CBAlarmHoldoff.SelectionBoxItem = (int)GlobalVars.User_Parameters.alarm_holdoff.ToString();
Sutton Mehaffey19 reputationPosted Nov 3, 2011, 8:41 AM EDT
VulpesRank #55 · 29.2K reputationPosted Nov 3, 2011, 8:50 AM EDT
VulpesRank #55 · 29.2K reputationPosted Nov 3, 2011, 9:10 AM EDT