473,394 Members | 1,739 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,394 software developers and data experts.

How to know if a form is already open ??

LB
How may i do to know if a form is already open ??
In vb6, i use Forms but i don't know how to do this in vbnet.
Thank you!!!
Oct 5 '07 #1
2 3158
LB wrote:
How may i do to know if a form is already open ??
In vb6, i use Forms but i don't know how to do this in vbnet.
If you're using VS2005, you can access a collection of open forms using the
Windows.Forms.Application.OpenForms collection, which works like the Forms
collection did in VB6.

If you're using an earlier version is VB.NET, you'll have no option but to
implement your own Forms collection, which can be quite a lot of messing
about...

--

(O)enone
Oct 5 '07 #2
LB wrote:
How may i do to know if a form is already open ??
In vb6, i use Forms but i don't know how to do this in vbnet.
Thank you!!!

I do this...
'Define the form on the main form so every other form can "see it"
Public Shared fHome As frmHome = Nothing

Then for the button click to open ur form.
In my case its an MDI app.
===
Private Sub tsbHome_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tsbHome.Click

' If the instance still exists... (ie. it's Not Nothing)
If Not IsNothing(fHome) Then
' and if it hasn't been disposed yet
If Not fHome.IsDisposed Then
' then it must already be instantiated - maybe it's
' minimized or hidden behind other forms ?
fHome.BringToFront() ' Optional
Else
' else it has already been disposed, so you can
' instantiate a new form and show it
fHome = New frmHome
fHome.MdiParent = Me
fHome.WindowState = FormWindowState.Maximized
fHome.Show()
End If
Else
' else the form = nothing, so you can safely
' instantiate a new form and show it
fHome = New frmHome
fHome.MdiParent = Me
fHome.WindowState = FormWindowState.Maximized
fHome.Show()
End If

End Sub
Oct 5 '07 #3

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

Similar topics

3
by: P | last post by:
Hi, Access 2002. I use DoCmd.OpenForm attached to command buttons to open one form from another form. All forms are open in dialog mode. When a user tries to open a form already opened from a...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
3
by: Susan Bricker | last post by:
Greetings. I have three forms that are open at the same time. They are related and cascading. The first form (frmEventAdd) is the anchor. Each event can have many Trials. The second form is...
9
by: RichG | last post by:
In VB 5 I could have a form named frmTest and open it with frmTest.Show Now in VB.net I have to Dim frm as New frmTest frm.show The problem is I only want one instance of frmTest open, not a...
9
by: KelsMckin | last post by:
Hello, I was wondering if there was a way to check there was already a form open before opening a new one, sorry that doesnt seem clear, here is an example: The following button opens a new form...
1
by: ollyculverhouse | last post by:
Hi, I have a custom menubar which lets users jump to useful forms in my database. For example if I first open a form called 'Add Individual' then another called 'Add Firm', if i try opening...
2
by: jpr | last post by:
I am using moduled to open forms. I run them from a menu that I have created on the toolbar. The source of the forms are queries all with record source to "lstpreinterview" on a form named eforms....
19
by: =?Utf-8?B?R3JlZw==?= | last post by:
How can I tell via code if a Form is already open. Each time my forms load I have some initialization code that runs, but if the form is already open and hidden I don't want that initialization...
5
by: billa856 | last post by:
Hi, My project is in MS Access 2002. In that I want to open one form multiple times. I put one button on my main form. Now whenever I click on that button than form will be open. Now when I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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...
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...

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.