Hi all,
i am trying to convert words( i.e one,two,three....) to numbers(1,2,3....).Convert.ToInt32 or Parse did not work. Can anybody please guide me how can i achieve that.
Thanks a lot in advance.
Hi all,
i am trying to convert words( i.e one,two,three....) to numbers(1,2,3....).Convert.ToInt32 or Parse did not work. Can anybody please guide me how can i achieve that.
Thanks a lot in advance.
Know the answer? Post it. Somebody with the same question will find it here.
Matthew Cathey6 pointsPosted Sep 3, 2008, 2:26 PM EDT
Create an int variable in the main form class. When the user enters/selects the number option (One, Two, Three, etc.) from the object (combo box, label, etc.) have that selection assign the corresponding number to the int variable. For example: public partial class frmMain:Main { int intNumber; //Using a combo box private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { switch (comboBox1.Text) { case "One": intNumber = 1; break; case "Two": intNumber = 2; break; case "Three": intNumber = 3; break; default: break; } } }