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

Reference an open form

I've been attempting to find out how this is accomplished in .NET,
because it appears to be far less simple then in 6. Essentially, I want to
be able to hide and display an existing form, instead of having to create a
new instance of the form everytime I need it. With VB 6 it was as simple as
form1.show and form1.hide, but in .NET, I'm at a loss; and I can never seem
to locate the information I need in the Library. Any pointers to where I
might find more information on the way forms are now handled would be
greatly appreciated.

- Jake G.
Nov 20 '05 #1
5 1273
Dim MyForm as New YourFormName

MyForm.show()
MyForm.hide()
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"J. Garrido" <no****@email.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I've been attempting to find out how this is accomplished in .NET,
because it appears to be far less simple then in 6. Essentially, I want to
be able to hide and display an existing form, instead of having to create a new instance of the form everytime I need it. With VB 6 it was as simple as form1.show and form1.hide, but in .NET, I'm at a loss; and I can never seem to locate the information I need in the Library. Any pointers to where I
might find more information on the way forms are now handled would be
greatly appreciated.

- Jake G.

Nov 20 '05 #2
Hi Terry, thanks for the quick reply, but the problem with that snippet
is that it will create a new instance everytime it is run. I need to
reference a pre-existing instance.

- JG
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:Oi**************@TK2MSFTNGP10.phx.gbl...
Dim MyForm as New YourFormName

MyForm.show()
MyForm.hide()
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"J. Garrido" <no****@email.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I've been attempting to find out how this is accomplished in .NET,
because it appears to be far less simple then in 6. Essentially, I want to be able to hide and display an existing form, instead of having to
create a
new instance of the form everytime I need it. With VB 6 it was as simple

as
form1.show and form1.hide, but in .NET, I'm at a loss; and I can never

seem
to locate the information I need in the Library. Any pointers to where I
might find more information on the way forms are now handled would be
greatly appreciated.

- Jake G.


Nov 20 '05 #3
Create the instance at class level, then you can call it from anywhere in
the form, alternatively, declare a sub main and use that to call your main
form and declare the ones you need.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"J. Garrido" <no****@email.com> wrote in message
news:ua**************@TK2MSFTNGP09.phx.gbl...
Hi Terry, thanks for the quick reply, but the problem with that snippet is that it will create a new instance everytime it is run. I need to
reference a pre-existing instance.

- JG
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:Oi**************@TK2MSFTNGP10.phx.gbl...
Dim MyForm as New YourFormName

MyForm.show()
MyForm.hide()
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"J. Garrido" <no****@email.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I've been attempting to find out how this is accomplished in .NET,
because it appears to be far less simple then in 6. Essentially, I want
to
be able to hide and display an existing form, instead of having to create
a
new instance of the form everytime I need it. With VB 6 it was as

simple as
form1.show and form1.hide, but in .NET, I'm at a loss; and I can never

seem
to locate the information I need in the Library. Any pointers to where

I might find more information on the way forms are now handled would be
greatly appreciated.

- Jake G.



Nov 20 '05 #4
* "J. Garrido" <no****@email.com> scripsit:
I've been attempting to find out how this is accomplished in .NET,
because it appears to be far less simple then in 6. Essentially, I want to
be able to hide and display an existing form, instead of having to create a
new instance of the form everytime I need it. With VB 6 it was as simple as
form1.show and form1.hide, but in .NET, I'm at a loss; and I can never seem
to locate the information I need in the Library. Any pointers to where I
might find more information on the way forms are now handled would be
greatly appreciated.


Google for the Singleton design pattern. By implementing this pattern,
you can access your form's default instances easily.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5
Great! Thanks guys, I will look into both of those things.

- JG
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
* "J. Garrido" <no****@email.com> scripsit:
I've been attempting to find out how this is accomplished in .NET,
because it appears to be far less simple then in 6. Essentially, I want to be able to hide and display an existing form, instead of having to create a new instance of the form everytime I need it. With VB 6 it was as simple as form1.show and form1.hide, but in .NET, I'm at a loss; and I can never seem to locate the information I need in the Library. Any pointers to where I
might find more information on the way forms are now handled would be
greatly appreciated.


Google for the Singleton design pattern. By implementing this pattern,
you can access your form's default instances easily.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #6

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

Similar topics

2
by: Horness | last post by:
Hi All, We're in the process of re-writing the Intranet at work, and my javascript knowledge could be written on the back of a post card. ;-) Can any of you point me in the direction of some...
0
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
2
by: Zippy | last post by:
Some months ago, we requested help from this newsgroup on how to replace the library reference of a database with another library reference, prior to creating an MDE. I got the following answer...
0
by: John Hunter | last post by:
I've recently had a nasty problem with the "Invalid reference to the property Form" error in subforms - nasty because it doesn't seem to consistently happen to all forms which contain the same...
3
by: Patrick.O.Ige | last post by:
I'm loading an Array below but getting the error "Object reference not set to an instance saying 'ItemNumber = CType(Args.Item.FindControl("ItemNumber"), TextBox).Text' is the error line. I DON'T...
3
by: Giovanni Bassi | last post by:
Hello all, I have prepared a simple procedure to open forms only once. Here it is: -//- Private Sub OpenChildForm(ByRef objFormToOpen As System.Windows.Forms.Form, ByVal TypeToCreate As...
2
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the...
0
by: SammyBar | last post by:
Hi all, My problem is basic. I'm starting to try web services with Visual Studio .NET 2002, .NET Framework 1.0. I'm testing the following configuration for my project. It's a ASP.NET Web Service...
3
by: b0b3rt | last post by:
Hi. I've got a problem with object references in a second form in the application. I'll just post the code of both forms. The error is at the bottom of the post. First form (With textbox)....
2
by: =?Utf-8?B?U2FuZHk=?= | last post by:
Hi everyone Some help pls. 1. MDI Parent Form Have a variable Public TestVariable As String = "AAA" In the Load procedure TestVariable = "BBB" 2. MDI Child Form
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...

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.