473,657 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Show hidden form1

Hello there,

I have a form that is called from a Sub Main procedure using
application.run (Form1).

On my main form there is a button to open an instance of Form2 and
then at the same time hide Form1.

So far so good.

What I would like to then do is to have a close button on Form2 which
closes Form2 (not a problem) but then re-shows the hidden form1 (or at
least the instance of the hidden form1).

Can anyone show me how to achieve this?

Thank you very much.

Richard

Nov 21 '05 #1
1 1903
There are a ton of methods of referencing a form from another form. This is
probably one of the most common questions asked on these boards. Here's one
solution:

Create a Module and declare a variable of type Form1 and one of type Form2.
When the application starts, assign your start-up form to the Form1 variable
in the Module. Also instantiate (but hide) an instance of Form2 and assign
it to the Form2 variable in your module.
Now whenever you want Form1 to be shown, just hide Form2 and un-hide Form1
via the variables in the Module.

I.e.,

' From the Module
Dim f1 As Form1
Dim f2 As Form2

' In your form1 Load method
f1 = Me
f2 = New (Form2)

' When you want to show form1 and hide form2
f1.Visible = true
f2.Visible = false
f1.Activate()

' When you want to show form1 and hide form2
f2.Visible = true
f1.Visible = false
f2.Activate()

You'll need to cancel the Close event for each form or have some other
mechanism to tell when a form has been closed and needs to be re-created.

"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:p9******** *************** *********@4ax.c om...
Hello there,

I have a form that is called from a Sub Main procedure using
application.run (Form1).

On my main form there is a button to open an instance of Form2 and
then at the same time hide Form1.

So far so good.

What I would like to then do is to have a close button on Form2 which
closes Form2 (not a problem) but then re-shows the hidden form1 (or at
least the instance of the hidden form1).

Can anyone show me how to achieve this?

Thank you very much.

Richard

Nov 21 '05 #2

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

Similar topics

7
4142
by: Mad Scientist Jr | last post by:
Through messing around I got IE6 (win xp) to show/hide a table row. I gave my <TR> an ID of "trRow" and trRow.style.display='none'; hides it trRow.style.display='block'; displays it (will any value other than 'none' display on IE6?) I tried enclosing the <TR></TR> inside a <DIV> tag, and hiding that, but it doesn't work for some reason.
13
74067
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide Form1.Visible = False Load (Form1)
3
2194
by: Roy Adams | last post by:
Hi I'm reposting this question because for some reason can't post follow up question to this thread. What I'm trying to do is put the value and text from a a select in to a text field and to a hidden field respectfully and the value from dynamically created hidden fiields in to a text fieldin to a text field all at the same time Here's the code as viewed through the browser <body bgcolor="#FFFFFF" text="#000000" > <SCRIPT...
3
10191
by: veganeater | last post by:
Hi, I'm wondering if there's a way that I can select which <div> to show based on the user's selection from a dropdown/listbox form. <form name="form1" method="post" action=""> <select name="internet"> <optgroup label="Network"> <option label="option1">Internet</option> </optgroup>
5
13287
by: Susan | last post by:
I have an application. When a user minimizes it it hides itselfs but stays activate in the system tray. Since it is hidden the user may think that they have exited the application and now may attempt to create a new instance by launching the program again. The problem that I am running into is being able to restore the previous application. I am able to end the multiple instance application but since the previous application is hidden I...
2
2422
by: John Holmes | last post by:
I would like to turn on a label control in javascript with the onfocus event of another control by setting the Visible property to true. When I try and reference this label control it says "Microsoft JScript runtime error: 'document.Form1.lblSigGrantor' is null or not an object". I wrote a loop and iterated through the elements for the form and this control doesn't show up. Code listed below, please help. Thanks, John Holmes
2
3108
by: Hareth | last post by:
VS2003 if i say dim form1 as new form1 form1.show() It opens a new form everytime... But....what if....
17
4761
by: Jim Burns | last post by:
How do I Get a ref to my hidden Object like a Form1 When I try to Show the Form1 from Form2 I can not get a reference to the same instance. I can Show New Form1's but I cant unhide The one I Hid Thanks again for the Imagelist Answer. it worked
3
4979
by: alcapoontje | last post by:
i'm making somekind of pad with commandbuttons and different forms. -> when you click the cmd on form1, form1 is hidden and form 2 is showed when you click the cmd on form2, form2 is hidden and form3 is showed -> the problem: if you click the cmd on form 3 normally form1 has to be showed and form3 has to be hidden. but when i do this i receive an error when you think you can help me and you need the program, i'll mail it to you (warning:...
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4152
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.