Hi,
i am working with C sharp dot net application, where i have more forms,.
i have to move to next form at the same time i have to hide the the existing form. it works fine in VB.net but not coming in csharp.net.
Can any one help me how to hide the active form when i move to next form
Thanks in advance,
Magesh
6 3811 tlhintoq 3,525
Recognized Expert Specialist
The methods .Hide() and .Show() are what you should be using.
I Tried using -
form f1 = new form1()
-
f1.hide();
-
form2 f2 = new form2()
-
f2.show();
-
But second form came to screen, but first form is still alive..
Regards,
tlhintoq 3,525
Recognized Expert Specialist
I seriously doubt that your new instance of Form1 is visible since you have not yet shown it.
You do realize you could have many instances of Form1, right? My guess is that your application starts in an instance of Form1 and that it is that instance of Form1 you are seeing. Making a *new* Form1 is not going to let you hide the *old* Form1
If you're on the currently active form, and you want a second form to show, you'll need to do something like this: - Form2 f2 = new Form2();
-
this.Hide();
-
f2.Show();
The problem with this, however, is getting your original form to show again later. You'll need some reference to it to bring it back.
tlhintoq 3,525
Recognized Expert Specialist
I generally think that Form1 or whatever is the form that Program.cs launches shouldn't show. This is where I tend to stick a lot of the thinking of a program, but not the face of it.
That way it is always available, and it knows all the other forms/classes. It can then open the form "UserMain", "UserConfig", "UserPreferences"
tlhintoq 3,525
Recognized Expert Specialist
Alternatively, you can just make a reference to your Form1 in the Program.cs file. - public Form1 MyMainForm = new Form1();
Then launch MyMainForm as your interface.
From here forward any form can reach the main form through the program file. - Program.MyMainForm.Hide();
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Willoughby Bridge |
last post by:
Hi -
Having trouble getting a multipart series of forms to move to the next form.
The problem line is:
<form method="post" enctype="multipart/form-data" action="Data_Form1.php">
If the...
|
by: Peter Rilling |
last post by:
What events are fired when the Form.Show() and Form.Hide() methods are
called.
I know Load fires the first time, but what about showing and hiding the form
at any point during its life cycle?
...
|
by: Rod Snyder |
last post by:
I'm looking for a way that when a user enters the required information in a
form text box, the cursor automatically moves to the next textbox (asp.net).
Can this be done in ASP.NET or must it be...
|
by: Daniel R. Rossnagel |
last post by:
As I can hide the bar of I title of a window daughter maximized within form
MDI Already I have proven with different types from borders, hiding
thebuttons to maximize, to diminish and control box,...
|
by: MLH |
last post by:
I thought it was DoCmd.GoToPage - but that doesn't work for
Tab Controls, it seems - only for forms with page breaks in them.
Anybody know Syntax form moving from page-to-page (actually,...
| |
by: majeedwm2 |
last post by:
Hi all
i am bullding a windows application which have :
LabelLink1
LabelLink2
LabelLink3
GroupBox1
GroupBox2
GroupBox3
|
by: =?Utf-8?B?RWl0YW4=?= |
last post by:
Hello,
I created a Modal form (WinForm). I would like to prevent the user from
moving the form around on the screen. How would I do that?
Thanks,
EitanB
|
by: Peter Anthony |
last post by:
It seems kind of strange that if a Form is just moved that Resize events
fire. This makes it hard to tell the difference betweeen resizing and moving
a Form.
I can understand why resizing might...
|
by: HaLo2FrEeEk |
last post by:
I'm making a screenshot program that lets me position a secondary form and press a button in the main form to take a screenshot where the second form is located. I have the second form set to have...
|
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,...
|
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...
| |
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,...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |