Multiple Instance form
-
i would like to know if its possible to open 2 or more similar form without changing the opened form parameter as example existing form opened int value is 123, after opening another similar form, int is set to 456 but i do not want it changed in the previos opened form. hope u get what i mean.
-
i would like to know if its possible to open 2 or more similar form without changing the opened form parameter as example existing form opened int value is 123, after opening another similar form, int is set to 456 but i do not want it changed in the previos opened form. hope u get what i mean.
Hi, this is quite simple. Normally if you open a second instance of the form, the content of the first form is not modified. If it is, you are accessing a static object or some other shared resource. Here is some code that opens two instances of the same form (Form2) when clicking a button.
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2_1 = new Form2();
frm2_1.Show();
Form2 frm2_2 = new Form2();
frm2_2.Show();
} -
i would like to know if its possible to open 2 or more similar form without changing the opened form parameter as example existing form opened int value is 123, after opening another similar form, int is set to 456 but i do not want it changed in the previos opened form. hope u get what i mean.
-
i would like to know if its possible to open 2 or more similar form without changing the opened form parameter as example existing form opened int value is 123, after opening another similar form, int is set to 456 but i do not want it changed in the previos opened form. hope u get what i mean.
Forms are just classes; you can instantiate them as often as you like; and no fields get shared between instances unless they are marked static. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum