1. How do I define multi forms in the same winform app (C#) ?
multi forms in one desktop application
Collapse
X
-
-
Thank
But I ment standard application that pressing on a button in one form causes
opening another form.
nor multi documents at the same timeComment
-
Oh, sorry. You can just open another form... a Form object has a Show and a ShowDialog method. Show opens the form and lets you interact with other forms in that application. ShowDialog opens it as modal, which means you can't change focus to any other form until you close that one.
You just open it up in the button click event... here's a snippet.
Code:... private void button1_Click(object sender, EventArgs e) { OtherForm otherForm = new OtherForm(); otherForm.ShowDialog(); if (otherForm.SomeStringProperty == "SomeStringValue") // Do something } ...
Comment
-
Thanks alot
I understood what you said.
Now
First I opened a C# winform application
and implemented the form (Form1).
Then I did Project->add windows form
It opened relevant files. I implemeted them (Form2).
But, When I wanted to define an object of class "Form2"
in the handle of a button of form1, It did not recognize Form2.
Maybe there is a need to somehow do
some compilation or configuration connection between these two ???
RegardsComment
-
-
Comment