Hi im trying to create a switch statement which you see below. I created a combo box and Im trying to set constants if certain numbers are selected in the combo box. The error message that I am getting is "cannot implicity convert type 'double to 'string'. How can I set a constat to certain values using a switch statement. I have to calculate the number of hours rentted * the siz of the yacht (which are the constatnts). Thanks for any feedback.
here are the constats values:
here are the constats values:
Code:
const double YACHT_22 = 95.00;
YACHT_24 =137.00;
YACHT_30 = 160.00;
YACHT_32 = 192.00;
YACHT_36 = 250.00;
YACHT_38 = 400.00;
YACHT_45= 550.00;
double.Parse(comboBoxsizeofyacht.Text);
switch (comboBoxsizeofyacht.Text)
{
case "22":
comboBoxsizeofyacht.Text = YACHT_22;
break;
case "24":
comboBoxsizeofyacht.Text = YACHT_24;
break;
case " 30 ":
comboBoxsizeofyacht.Text = YACHT_30;
break;
case " 32 ":
comboBoxsizeofyacht.Text = YACHT_32;
case " 36 ":
comboBoxsizeofyacht.Text = YACHT_36;
break;
case "38":
comboBoxsizeofyacht.Text = YACHT_38;
break;
case "45":
comboBoxsizeofyacht.Text = YACHT_45;
break;
}
Comment