Click to See Complete Forum and Search --> : is form loaded
vin
July 19th, 2001, 07:49 AM
Hi,
In certain point in my program I want to check if a form is loaded. I tried to do this by checking the "form.visible" property. However when I check this property if the form is not loaded it starts to load itself which is undesirable. Can anyone suggest better approach.
Thanks
Valery Iskarov Nikolov
http://listen.to/quark
Clearcode
July 19th, 2001, 07:57 AM
private Function IsFormLoaded(byval FormName as string) as Boolean
Dim fTmp as Form
for Each fTmp In Forms
If fTmp.Name = FormName then
IsFormLoaded = true
Exit for
End If
next fTmpo
End Function
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
vin
July 19th, 2001, 07:59 AM
10x, That's it
Regards
Valery Iskarov Nikolov
http://listen.to/quark
Cakkie
July 19th, 2001, 07:59 AM
You can use the forms collection
public Function IsFormLoaded(strName as string) as Boolean
Dim frm as Form
IsFormLoaded = false
for Each frm In Forms
If frm.Name = strName then
IsFormLoaded = true
Exit for
End If
next frm
End Function
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
lolla
November 20th, 2001, 03:24 PM
I would add a property to the form I want to check or loading.
option Explicit
private m_FormLoaded as Boolean
private Sub Form_Load()
m_FormLoaded = true
' do other stuff
End Sub
public property get isLoaded() as Boolean
isLoaded = m_FormLoaded
End property
public property let isLoaded(newVal as Boolean)
m_FormLoaded = newVal
End property
Cakkie
November 21st, 2001, 12:55 AM
One thing you need to keep in mind is when accessing a property of a form, the form actually get's loaded, so after a loop checking for the property, all forms will be loaded.
Tom Cannaerts
slisse@planetinternet.be
Moderator on http://www.vbcodelibrary.co.uk/board
A bottomless pit, I'm sure it came with the place, who would dig one on purpose?
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.