473,804 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Managing display of a form

I have Form1 and Form2. Form2 has to be loaded in memory so that controls on
it can be controlled from Form1, so I declared it in the Form1 declaration
section. That works OK.
Now I just need to make form2 visible once and make it invisible again,
although it should be staying active in memory. If I have a global boolean
g_form2Shown then to show it I can, in a click event in form1 do

If not g_Form2Shown then
Form2.show 'the declaration was made in the form1 declaration section so
I don't have to dim the form as new here.
end if

However I don't want to unload Form2 from memory. It must continue to work
in the background. I just want to make it invisible. If I put a button on
Form 2 what code can I in it use to make it invisible but keep it working.

Thanks for any help
Bob
Oct 21 '06 #1
2 1386
When you access forms globally by their name (as with "Form2.Show()") , you
are really accessing them via the My.Forms object (as in "My.Forms.Form2 .Show()").
Once you access them, they stay in memory until you specifically set them
to nothing.

Form2 = Nothing

Within Form2, you can use the "Me.Hide()" method to make the form invisible.

If you don't want to use the global references to a form, you can create
an instance of a form and manipulate it that way.

Dim instanceOfForm2 As Form2
...
instanceOfForm2 = New Form2
instanceOfForm2 .Show()
...
instanceOfForm2 .Hide()
...
instanceOfForm2 = Nothing

-----
Tim Patrick
Start-to-Finish Visual Basic 2005

I have Form1 and Form2. Form2 has to be loaded in memory so that
controls on
it can be controlled from Form1, so I declared it in the Form1
declaration
section. That works OK.
Now I just need to make form2 visible once and make it invisible
again,
although it should be staying active in memory. If I have a global
boolean
g_form2Shown then to show it I can, in a click event in form1 do
If not g_Form2Shown then
Form2.show 'the declaration was made in the form1 declaration
section so
I don't have to dim the form as new here.
end if

However I don't want to unload Form2 from memory. It must continue to
work in the background. I just want to make it invisible. If I put a
button on Form 2 what code can I in it use to make it invisible but
keep it working.

Thanks for any help
Bob

Oct 21 '06 #2
Thanks,

Bob

"Tim Patrick" <in*****@invali d.com.invalidwr ote in message
news:e3******** *************** **@newsgroups.c omcast.net...
When you access forms globally by their name (as with "Form2.Show()") , you
are really accessing them via the My.Forms object (as in
"My.Forms.Form2 .Show()"). Once you access them, they stay in memory until
you specifically set them to nothing.

Form2 = Nothing

Within Form2, you can use the "Me.Hide()" method to make the form
invisible.

If you don't want to use the global references to a form, you can create
an instance of a form and manipulate it that way.

Dim instanceOfForm2 As Form2
...
instanceOfForm2 = New Form2
instanceOfForm2 .Show()
...
instanceOfForm2 .Hide()
...
instanceOfForm2 = Nothing

-----
Tim Patrick
Start-to-Finish Visual Basic 2005

>I have Form1 and Form2. Form2 has to be loaded in memory so that
controls on
it can be controlled from Form1, so I declared it in the Form1
declaration
section. That works OK.
Now I just need to make form2 visible once and make it invisible
again,
although it should be staying active in memory. If I have a global
boolean
g_form2Shown then to show it I can, in a click event in form1 do
If not g_Form2Shown then
Form2.show 'the declaration was made in the form1 declaration
section so
I don't have to dim the form as new here.
end if

However I don't want to unload Form2 from memory. It must continue to
work in the background. I just want to make it invisible. If I put a
button on Form 2 what code can I in it use to make it invisible but
keep it working.

Thanks for any help
Bob


Oct 22 '06 #3

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

Similar topics

1
1642
by: Saradhi | last post by:
I am hosing website using ASP on windows2003 standard server in IIS 6.0 sessions are getting expired immediately. Could any one help me in managing sessions in iis 6.0 and ASP?
2
409
by: Robin | last post by:
H I am having some problems with form creation & navigation in .NET. I have a sub main that calls my first form (login) using the application.run() method. If the validations are correct I wish to call another form (mdI type) and close form1. I realize that if I declare a variable for form2 in form 1 when I close form1 I destroy form2. I tried declaring the form publicly outside of form1 but it still shuts down. I don't want to get into...
19
6937
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
14
1827
by: RL Stevenson | last post by:
What is a reasonable way to manage a complex form with 5 or so tabs with 100 or more controls bound to 5-10 tables in a database? Pasting all those controls, datasets, data adapters directly onto the form resulted in an unwieldy file of nearly 10,000 lines of code. Seems like there must be a better way.
8
2172
by: Braky Wacky | last post by:
Hello, I have an ASP.NET webpage that uses an instance of System.Web.UI.HtmlControls.HtmlInputFile for uploading files to our server. I came across the documentation at MSDN for upping the filesize limit, once I saw the behavior of the page bombing with files bigger than 4 MB. So far so good. But the situation I'm coming across is that there doesn't seem to be an elegant way of recovering from a user attempting to upload files
1
1127
by: kamkoum | last post by:
Hello, I am using readxml to retrieve data from an xml file to a dataset. m xml file has hierarchical data (2 levels) so the dataset will contain tables. My question : I need to display this data like this :
1
2625
by: John Phelan-Cummings | last post by:
When I add the name of a new individual in a, bound form, it will not display that person’s name in a label control of a second unbound form. I have a scheduling program that I am working on. Included in the application program is a data “GRID” which I believe was created using Visual Basic, not standard Access. Its purpose is to display the results of a range of “from-to-dates” of registrations for different clients. The difficulty...
0
1170
by: Jordan Richard | last post by:
I'm designing a new .NET 2.0 Windows Forms application to support users who, amongst other things, need to print letters and envelopes. They currently do such printing by manually managing a collection of MS Word documents. They want for the new Windows Forms application to provide the capability to and envelopes. I'm wondering what would be a smart way to provide this capability. I don't want to re-invent MS Word, so perhaps I could...
0
1139
by: Dale | last post by:
Access 2000 (mdb / mde) Frt End to SQL 2000 Backend I have an Access app that is linked to SQL 2000 using the DSN-Less method. I have 3 sql servers (3 different locations) that contain the exact same database (achieved through replication) When the user moves to a different office, they need to connect to the sql server located in that office for speed issues. I am trying to create a user interface to allow the user to connect to...
0
9715
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
10352
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10097
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
9175
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
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
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...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
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.