I am trying to open 2 forms when I start my vs2005 project. The main form, and a second form whose class is created, and then ->show. It shows both forms, but you can control either one. What I want is the main form to be "locked" until the "OK" or "CANCEL" button is pushed on the secondary form. How do I do this? Here is the code in the constructor of the main form.

form3^ init = gcnew form3();	//Createa a new instance
			Project1::MainForm::AddOwnedForm(init);				//adds to ownership of form to MainForm

			init->Show();

'

Thanks.

Member Avatar for jencas

Use ShowDialog() instead of Show() for a modal dialog.

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.