473,406 Members | 2,713 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,406 software developers and data experts.

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 1370
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*****@invalid.com.invalidwrote in message
news:e3*************************@newsgroups.comcas t.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
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
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...
19
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...
14
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...
8
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...
1
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...
1
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. ...
0
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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
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,...

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.