Button +1 Clicker Visual Studio C++

Hi all I am using Visual Studio C++ 2010,
I am creating a Windows Form and I have a button "button1" that when I click I would like the txt box underneath "textBox1" to add a 1 then if clicked again 2, 3, 4 etc etc

when I double click the button it takes me to the Form1.h* Displaying the following code:

#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
}
};
}

Can somebody please guide me what to type in to make numbers appear in the "textBox1" section underneath my button?
What has happened is that your IDE has created a function for you. This function will be called when the user clicks the button. So, put the code you want to run when the user clicks the button inside the function.

1
2
3
4
5
6
7
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

  Int32 x = System::Int32::Parse( textBox1->getText() );
  x += 1;
  textBox1->setText( x.ToString() );

}

I know nothing about Microsoft Managed C++ stuff, so I am not sure the code above is exactly right, but it should get you started.

Hope this helps.
Topic archived. No new replies allowed.