Hello,
I am new to using windows form application in c++ and i am having a problem with making my program work. I have three textBars and one button. The first textBar is for the user to input a double. When the button is pressed i want it to perform the mathmatical task: textBox1 * 150 / 60, and show the results in textBox2. Then, textBox2 * 20 / 60 results in textBox3. All with the one button click.

What version of Visual Studio are you using? M$ dropped support for c++ Windows
Forms in VS 2012.

textbox.Text = "something" will set the text in a textbox, read this link for all properties/methods.

So to make the calculation just convert the text in the textbox to an int, make calculations, convert result to a string, and assign back to the textbox. Since you are working with CLR/C++ I assume you already know how to to most of that.

Im using VS 2010 prof. Thanks for the help.

Ok i got the code to work, but how do i get my decimals to round to the second decimal place after the decimal like 1.11?

#pragma endregion
        double x,y,z;
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
            x=System::Convert::ToDouble(this->textBox1->Text);
            y= x*150/60;
            this->textBox2->Text = System::Convert::ToString(y);
            z= y*20/60;
            this->textBox3->Text = System::Convert::ToString(z); 
            }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
             this->textBox1->Text="";
             this->textBox2->Text="";
             this->textBox3->Text="";
         }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.