473,511 Members | 10,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide active form while moving to next form

119 New Member
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
Nov 9 '09 #1
6 3811
tlhintoq
3,525 Recognized Expert Specialist
The methods .Hide() and .Show() are what you should be using.
Nov 9 '09 #2
phpmagesh
119 New Member
I Tried using
Expand|Select|Wrap|Line Numbers
  1. form f1 = new form1()
  2. f1.hide();
  3. form2 f2 = new form2()
  4. f2.show();
  5.  
But second form came to screen, but first form is still alive..

Regards,
Nov 9 '09 #3
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
Nov 9 '09 #4
Curtis Rutland
3,256 Recognized Expert Specialist
If you're on the currently active form, and you want a second form to show, you'll need to do something like this:
Expand|Select|Wrap|Line Numbers
  1. Form2 f2 = new Form2();
  2. this.Hide();
  3. 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.
Nov 9 '09 #5
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"
Nov 9 '09 #6
tlhintoq
3,525 Recognized Expert Specialist
Alternatively, you can just make a reference to your Form1 in the Program.cs file.


Expand|Select|Wrap|Line Numbers
  1. 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.


Expand|Select|Wrap|Line Numbers
  1. Program.MyMainForm.Hide();
Nov 9 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1795
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...
1
18653
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? ...
1
1009
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...
4
5514
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,...
1
1668
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,...
1
1619
by: majeedwm2 | last post by:
Hi all i am bullding a windows application which have : LabelLink1 LabelLink2 LabelLink3 GroupBox1 GroupBox2 GroupBox3
0
1183
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
0
1575
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...
6
5660
HaLo2FrEeEk
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...
0
7245
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
7144
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
7356
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
7427
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...
1
7085
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...
0
7512
tracyyun
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...
0
3227
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...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.