2 Replies - 5170 Views - Last Post: 30 January 2012 - 06:29 AM

#1 seker85  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 18-January 12

Visual Studio BMI Calculator problem

Posted 30 January 2012 - 02:45 AM

Hi guys,

I've made this BMI (Body Mass Index) calculator in visual studio 2010 with buttons and textboxes. I'm new in this so need a little help. I want to expand it with a IF statement. There are 5 cases in this BMI (from thin to obesity) so by looking at the output (BMI) I want to make a textbox (case) blink or highlight it.
Here is my code where I make the calculation. I took this from an calculator example and modified it. As you see text box 3 (BMI) is a string so could I convert this to a double and then make an if else statement or how is it going to be?

#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
			// To Convert the Result of Text Box 1 and 2 to String & Move it to Text Box 3. 
			this->textBox3->Text = System::Convert::ToString
			// Covert the Data in Text Box 1 to Double.
			( System::Convert::ToDouble( this->textBox1->Text )
			// Covert the Data in Text Box 2 to Double & Divide it with Text Box 2.
			/ ((System::Convert::ToDouble ( this->textBox2->Text))/100)/((System::Convert::ToDouble ( this->textBox2->Text))/100));
		}
 
			 private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
					  }
}


:code:

This post has been edited by jimblumberg: 30 January 2012 - 07:39 AM
Reason for edit:: Added missing Code Tags, Please learn to use them.


Is This A Good Question/Topic? 0
  • +

Replies To: Visual Studio BMI Calculator problem

#2 seker85  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 18-January 12

Re: Visual Studio BMI Calculator problem

Posted 30 January 2012 - 03:19 AM

..and I also need help to show the list when typing something in the code. Example: when typing "text" a list appears with "textbox" "textbox1" etc.
Was This Post Helpful? 0
  • +
  • -

#3 kevindckr  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 105
  • Joined: 09-January 12

Re: Visual Studio BMI Calculator problem

Posted 30 January 2012 - 06:29 AM

You need to put that code in [c0de][/c0de] tags so that it is readable.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1