Loaded Form 
Author Message
 Loaded Form

Hello.
Which is the simplest way of knowing if a given form is loaded (Im not
talking about whether is active or not) ??
Thanks

Rolando



Mon, 22 Jul 2002 03:00:00 GMT  
 Loaded Form
If you are using at most one instance of each form, its fairly easy.    Look
through the Forms collection, checking for the Name of the form you want to
test.  For example

Public Function IsLoaded(ByVal sForm As String) As Boolean
    Dim f as Form
    IsLoaded = False    'guilty until proven innocent

    For Each f in Forms
        If f.Name = sForm Then
            IsLoaded = True
            Exit Sub
        End If
    Next f

End Function



Mon, 22 Jul 2002 03:00:00 GMT  
 Loaded Form
hello.
thanks for the help.
and, what about if I use several instances, i.e.  I use Dim X as myForm
and
X = New myForm ???
thanks


Quote:
> If you are using at most one instance of each form, its fairly easy.
Look
> through the Forms collection, checking for the Name of the form you want
to
> test.  For example

> Public Function IsLoaded(ByVal sForm As String) As Boolean
>     Dim f as Form
>     IsLoaded = False    'guilty until proven innocent

>     For Each f in Forms
>         If f.Name = sForm Then
>             IsLoaded = True
>             Exit Sub
>         End If
>     Next f

> End Function



Mon, 22 Jul 2002 03:00:00 GMT  
 Loaded Form

Does that make a difference if you have loaded multiple instances. What you
wanted to know if a particular form is active or not and you get this by
navigating through the forms collection



Quote:
> hello.
> thanks for the help.
> and, what about if I use several instances, i.e.  I use Dim X as myForm
> and
> X = New myForm ???
> thanks



> > If you are using at most one instance of each form, its fairly easy.
> Look
> > through the Forms collection, checking for the Name of the form you want
> to
> > test.  For example

> > Public Function IsLoaded(ByVal sForm As String) As Boolean
> >     Dim f as Form
> >     IsLoaded = False    'guilty until proven innocent

> >     For Each f in Forms
> >         If f.Name = sForm Then
> >             IsLoaded = True
> >             Exit Sub
> >         End If
> >     Next f

> > End Function



Tue, 23 Jul 2002 03:00:00 GMT  
 Loaded Form
Yes and no... you can determine if some instance of the specified form is
running using the technique I described.  However, you cannot tell which
particular instance.   The only really sucessful way to do this is to
maintain your own data structure with object references to the forms.


Tue, 23 Jul 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Not a loaded class error when loading form

2. VB6: application in runtime environment with error on loading form: ado cannot load object

3. How to load form using form name from field

4. ???????? GURUS - Showing or Loading Forms by use of String variable containing Form Name

5. VB4 Load form in form

6. Run-Time form loading - form name retrieved from database

7. Need to load Form onto Form

8. Error Message when Loading Form

9. Mac Word 98 VBA won't load form

10. Mac Word 98 VBA won't load form

11. Can't load forms

12. Dynamic loading forms using reflection

 

 
Powered by phpBB® Forum Software