Hi, I'm fairly new to C#
My Programming Class assignment has me creating a simple BMI Calculator in Microsoft VS.
I've made a working version but wanted to improve it by offering the User the option of choosing whether they want to enter their weight in either KG, Lbs, or Stone, and their height in either M, cm, or Inches.
I have two Combo Boxes setup with their respective selected items. I need to know how I'd go about changing the value of a double depending on which item is selected.
Eg. The height units selected would alter the value of the 'heightmultiplier' variable.
Any help would be greatly appreciated.
Combo Box Help
Page 1 of 12 Replies - 380 Views - Last Post: 24 March 2010 - 03:34 AM
Replies To: Combo Box Help
#2
Re: Combo Box Help
Posted 20 March 2010 - 08:33 AM
RoseScythe,
I'm not sure which part you need help with? Getting the data from the combo boxes? Or changing the double value after the selection?
If it's just the selection that's the issue, just pull the data from the combobox using:
Then you can use your favorite method for making decisions, if-then, switch, etc.
Does that help? Or did I misunderstand your question?
Thanks!
I'm not sure which part you need help with? Getting the data from the combo boxes? Or changing the double value after the selection?
If it's just the selection that's the issue, just pull the data from the combobox using:
string myselection = this.comboBox1.SelectedItem.ToString()
Then you can use your favorite method for making decisions, if-then, switch, etc.
Does that help? Or did I misunderstand your question?
Thanks!
RoseScythe, on 20 March 2010 - 01:28 AM, said:
Hi, I'm fairly new to C#
My Programming Class assignment has me creating a simple BMI Calculator in Microsoft VS.
I've made a working version but wanted to improve it by offering the User the option of choosing whether they want to enter their weight in either KG, Lbs, or Stone, and their height in either M, cm, or Inches.
I have two Combo Boxes setup with their respective selected items. I need to know how I'd go about changing the value of a double depending on which item is selected.
Eg. The height units selected would alter the value of the 'heightmultiplier' variable.
Any help would be greatly appreciated.
My Programming Class assignment has me creating a simple BMI Calculator in Microsoft VS.
I've made a working version but wanted to improve it by offering the User the option of choosing whether they want to enter their weight in either KG, Lbs, or Stone, and their height in either M, cm, or Inches.
I have two Combo Boxes setup with their respective selected items. I need to know how I'd go about changing the value of a double depending on which item is selected.
Eg. The height units selected would alter the value of the 'heightmultiplier' variable.
Any help would be greatly appreciated.
#3 Guest_RoseScythe*
Re: Combo Box Help
Posted 24 March 2010 - 03:34 AM
beju0506, on 20 March 2010 - 07:33 AM, said:
RoseScythe,
I'm not sure which part you need help with? Getting the data from the combo boxes? Or changing the double value after the selection?
If it's just the selection that's the issue, just pull the data from the combobox using:
Then you can use your favorite method for making decisions, if-then, switch, etc.
Does that help? Or did I misunderstand your question?
Thanks!
Cheers for the help. I figured it out. I didn't declare the Multiplier as a Class level variable so the new value was ignored outside the if statement.
I'm not sure which part you need help with? Getting the data from the combo boxes? Or changing the double value after the selection?
If it's just the selection that's the issue, just pull the data from the combobox using:
string myselection = this.comboBox1.SelectedItem.ToString()
Then you can use your favorite method for making decisions, if-then, switch, etc.
Does that help? Or did I misunderstand your question?
Thanks!
Cheers for the help. I figured it out. I didn't declare the Multiplier as a Class level variable so the new value was ignored outside the if statement.
RoseScythe, on 20 March 2010 - 01:28 AM, said:
Hi, I'm fairly new to C#
My Programming Class assignment has me creating a simple BMI Calculator in Microsoft VS.
I've made a working version but wanted to improve it by offering the User the option of choosing whether they want to enter their weight in either KG, Lbs, or Stone, and their height in either M, cm, or Inches.
I have two Combo Boxes setup with their respective selected items. I need to know how I'd go about changing the value of a double depending on which item is selected.
Eg. The height units selected would alter the value of the 'heightmultiplier' variable.
Any help would be greatly appreciated.
My Programming Class assignment has me creating a simple BMI Calculator in Microsoft VS.
I've made a working version but wanted to improve it by offering the User the option of choosing whether they want to enter their weight in either KG, Lbs, or Stone, and their height in either M, cm, or Inches.
I have two Combo Boxes setup with their respective selected items. I need to know how I'd go about changing the value of a double depending on which item is selected.
Eg. The height units selected would alter the value of the 'heightmultiplier' variable.
Any help would be greatly appreciated.
Page 1 of 1
|
|

New Topic/Question
Reply
MultiQuote







|