I am trying to create a windows form using visual c++. I type the variable value in the text box in windows and read it in by clicking a button. The variable is now stored in the form1.h header file.
I want to use that variable in the my_proj.cpp code, what should I do?
Thanks!

//part of the form1.h file
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

				 // read in from the text box my clicking the button
				 int var1 = System::Int32::Parse(textBox1->Text);
				 printf("%d\n", var1);

			 }
//part of my_proj.cpp
	Application::Run(gcnew Form1());

	int var1;
	printf("%d\n", var1);

prinf() doesn't work in Windows Forms applications because there is no console window for the 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.