473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to show existing form

Hi people.

I have a question - how to show existnig form?

I create two forms: Form1 and Form2 in designer. I place a button on
Form1 and I want to call a Form2 (better in modal mode!).

It's simple to show NEW form:
Form Form2 = new Form();
Form2.Show();

but i want to call a form I designed before.
Nov 17 '05 #1
5 15223
How about:

Form2 frm = new Form2();
frm.Show();

Nov 17 '05 #2
Isn't that the same?

Make form2 a member variable of your main form. In the main form's
construction instantiate form2. In the click handler call
form2.ShowDialog();

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
How about:

Form2 frm = new Form2();
frm.Show();

Nov 17 '05 #3
Eugene,

If you want to show a form that you have hidden before, then in the
instance of Form1 that you have, you should store the instance of Form2 that
was previously shown. Then, all you have to do is reference that parameter
and call the Show method.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eugene Turin" <tu*****@mail.ru> wrote in message
news:5e**************************@posting.google.c om...
Hi people.

I have a question - how to show existnig form?

I create two forms: Form1 and Form2 in designer. I place a button on
Form1 and I want to call a Form2 (better in modal mode!).

It's simple to show NEW form:
Form Form2 = new Form();
Form2.Show();

but i want to call a form I designed before.

Nov 17 '05 #4
Yes it works!
Thanx a lot!

"Chris Dunaway" <du******@gmail.com> wrote in message news:<11*********************@z14g2000cwz.googlegr oups.com>...
How about:

Form2 frm = new Form2();
frm.Show();

Nov 17 '05 #5
No, his original code was just creating an instance of a Form not an
instance of a Form2

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Antonio Paglia | last post by:
I would wish to be able to open an existing VB6 Form from my VB.NET application. All VB6 forms are in COM dll. My COM dll expose a Public Class with a method that return an instance of my VB6...
1
by: Sue | last post by:
I have a main form based on a member list, so that I can add details. I also have a query which takes its parameters from a textbox on the form to search for a surname so that I can delete the...
4
by: Altramagnus | last post by:
I have a form first created my the main thread. I have another thread monitoring the IO. Upon receiving certain message, I want to show/unhide the form. When the form is first created ( handle...
4
by: Haris Bogdanovic | last post by:
how do I refer to other form from main form so I can call its Show method ? Thanks Haris
1
by: Galka | last post by:
Hello I have a form to enter names and some other personal information. When a name is entered, it is checked against existing records: maybe, such name was entered before? If yes, user is...
1
by: Bob | last post by:
I have the follwing snippet of code, lets me find a document and then open it, but thw word application does not show up. I had similara to this in vb6 and it worked, but I can't get it to show...
3
by: erich | last post by:
In VS2005, creating a new form creates the form class and a partial (frm*.designer.vb) class file and displays the partial class beneath the main form frm*.vb, which is great. However, when...
11
by: andrewdb | last post by:
I have been working with a database that was already created by somebody else, who now no longer works here, so I cant ask any questions. None the less, there is a table 'Ascertainment' which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.