lundi 30 mars 2015

ComboBox and TextBox with Same Functions

Good day To All, i was wondering is there any possibility


Winform Items


A.) 1~5 ComboBox


B.) 1~5 Textbox for Time (i'll identify them for example as txtTime1 ~ txtTime5)


C.) 1~5 Textbox for Amount (i'll identify them for example as txtAmount1 ~ txtAmount5)


Items 1 ~ 5 (ComboBox 1-5 , txtTime 1-5, txtAmount 1-5) will do the same Functions.


A.)



if (combobox1.SelectedValue.ToString() == "Regular")
{
x = 1.25;
}
else if (combobox1.SelectedValue.ToString() == "Double")
{
x = 2;
}
// Same Codes for ComboBox 2~5


B.)Textbox "txtTime(s)" will hold a TextChange Event fetching values of our said comboBoxes



if (txtTime.Text.Lenght > 0)
{
// Item Letter "C"
// value of "x" is equal to the above item
txtAmount.Text = (double.Parse(txtTime.Text) * x).ToString();
}


i just need a quick idea on how will i make this work


Thank You in Advance


Aucun commentaire:

Enregistrer un commentaire