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

Home Posts Topics Members FAQ

Checking if a form has been already open

I'd like to check if a form is already open before opening it and if it is
not, then open it, otherwise just make it the active form.

How can I do that?

Regards,
Dino

--
-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com

Nov 20 '05 #1
4 1131
"Dino M. Buljubasic" <di************ *@rivusglobal.c om> wrote...
I'd like to check if a form is already open before opening it and if it is
not, then open it, otherwise just make it the active form.


Hi Dino... not a problem but I'm curious if you scan down the properties for
a form in the help. By that I only mean it can be a quick way to get an
answer... and I always find something new in there I didn't know while I am
looking for something else.

How about the .Visible property?

Tom
Nov 20 '05 #2
"Dino M. Buljubasic" <di************ *@rivusglobal.c om> schrieb
I'd like to check if a form is already open before opening it and if
it is not, then open it, otherwise just make it the active form.

How can I do that?


Private m_OtherForm As Form1

Private Sub OpenForm1()
If m_OtherForm Is Nothing Then
m_OtherForm = New Form1
AddHandler m_OtherForm.Clo sed, AddressOf OnOtherFormClos ed
m_OtherForm.Sho w()
End If
m_OtherForm.Act ivate()
End Sub

Private Sub OnOtherFormClos ed( _
ByVal sender As Object, ByVal e As System.EventArg s)

RemoveHandler m_OtherForm.Clo sed, AddressOf OnOtherFormClos ed
m_OtherForm = Nothing
End Sub
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #3
Hi Dino,

At the moment you have some of the code in classForms.vb and a lot more
scatterd around. - It should all be centralised in classForms.vb. It's one of
the things I wanted to show you before but didn't have time.

Rather than telling classForms that you have created a NewContactForm (by
setting the property), you should be <asking > classForms to create it for you
and pass it back. Then classForms can say - hold on, I've already got it here,
I'll just activate it for you.

When the form closes, it should tell classForms, otherwise classForms will
think it's still active.

Regards,
Fergus
Nov 20 '05 #4
Hi Fergus,

thanks for the reply. Yes, I know, that is my gray area. I am completelly
new to OOP!

I am doing something similar, but still not from the classForms. I'll do
some research on that. :)

Have you had any chance to look at the calendar? Any chance I get some help
on that annoying shifting in frmDailyCalenda r (the one when I want to type
something in daily calendar and click on a text box, and whole thing shifts
to the right? :) )

Regards,
Dino
PS. I shold be online again tomorrow, so I'll send you my home address as
well. What was your address?
PS. By the way, If you would like to get in touch with my boss, I'll send
you his email address once I get hooked up again.

--
-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com
"Fergus Cooney" <fi****@post.co m> wrote in message
news:eK******** ******@TK2MSFTN GP11.phx.gbl...
Hi Dino,

At the moment you have some of the code in classForms.vb and a lot more scatterd around. - It should all be centralised in classForms.vb. It's one of the things I wanted to show you before but didn't have time.

Rather than telling classForms that you have created a NewContactForm (by setting the property), you should be <asking > classForms to create it for you and pass it back. Then classForms can say - hold on, I've already got it here, I'll just activate it for you.

When the form closes, it should tell classForms, otherwise classForms will think it's still active.

Regards,
Fergus

Nov 20 '05 #5

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

Similar topics

3
1616
by: Steven Scaife | last post by:
Below is my ASP page, I have changed the update to read DRIAL which doesn't exist, shouldnt this throw an error, or if the connection cannot be made shouldnt it throw an error as well thanks in advance <%@language="VBScript"%> <% option explicit %> <% response.buffer = True %>
4
2182
by: Tonya | last post by:
Hi, Does anyone have any example of how i can manage forms in my application?? I want to be able to reference my form instances that are currently open from other forms. why cant i open and close forms as easily as in VB6??
25
10220
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 data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
7
11737
by: Shaldaman | last post by:
Hi Is there a property in MS Access for the following: 1) For a Command Button on a form, is there a property that can be used to determine if it has been clicked? eg: Me!button7.Clicked - I don't know if there is even a property like that(Clicked) 2) For a Text Field on a form, is there a property that can be used to find out if data has been entered in it? I've tried Me!Textfield1.Value = Null but I'm not sure if that's the
9
2166
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 new one each time. Is there a way to prevent this, or test for the form being open already?
4
2501
by: zack | last post by:
Any help with this would be greatly appreciated, as cannot work out how to resolve. I have a report called "3_Strikes". In its 'On open' event is command to also open a criteria form popup form called, "3_Strikes_Search". The purpose of the form is to allow input of data to filter the results of the report, (In this case mail-merged letters). The issue I have is that when I open the report via a command button, the "3_Strikes_Search"...
11
5284
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok / dangerous? How can I force shutdown code within the dialog's Form.FormClosed event run? Zytan
2
3181
by: LB | last post by:
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!!!
1
1739
by: Orbie | last post by:
Hi All, I'm new to VB.NET and i'm looking for some help with my Windows Form. I need to check if a Commodity entered into (TextBox1.Text) already exists on my table before i insert it. I'm having issues checking if the number of rows returned from my Select is equal 0? Also i'm wondering should i be checking for an exception and open/closing my connections each time i make a call to my DB or is the way i have it coded below OK?? Any input...
0
8421
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
8325
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
8742
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
7354
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...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
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
4173
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.