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) {
}
}
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.

New Topic/Question
Reply


MultiQuote



|