Forms 
Author Message
 Forms

I've got a program that loads and uses several forms. When I have a
form that is hidden, it can still be accessed. Is there a way to keep
a form from loading(besides hiding it) until it is told to load? If
so, is there a way to check if the form has been loaded yet?
Thanx
Jason


Sat, 22 Sep 2001 03:00:00 GMT  
 Forms
Jason

Sorry, didn't quite understand what you meant by 'When I have a form that is
hidden, it can still be accessed.'.

A form is not accessible by the user until it is loaded and shown. Any
reference to the form will cause it to be loaded first.

A hidden form should have its Visible property set to False at design-time
and then its Show method called (or Visible set to True) when required. The
form can be loaded (with the Load statement) at any time prior to that
without the user being aware of it.

As for testing whether a form is loaded, it is not possible (the test will
load it). The best you can do is to set a flag when you load it and test
that.

--
Regards
{*filter*}

Remove '!no!spam!' to reply by e-mail.


Quote:
>I've got a program that loads and uses several forms. When I have a
>form that is hidden, it can still be accessed. Is there a way to keep
>a form from loading(besides hiding it) until it is told to load? If
>so, is there a way to check if the form has been loaded yet?
>Thanx
>Jason



Sat, 22 Sep 2001 03:00:00 GMT  
 Forms
Jason,

If you reference a built-in property or method of a form it will
automatically load. However, you can assign it your own properties and
reference these without the form loading (it will initialize though). I am
not sure if this is what you are after. As for the checking of whether a
form has been loaded, you can traverse through the Forms collection to see
if it's in there. The Forms collection only holds loaded forms, whether they
are shown or not.

Dim frmLoaded As Form

For Each frmLoaded in Forms
    If frmLoaded Is frmTest Then
...
Next

Just replace frmTest with the name of your form.

--
HTH
VB-Joker

PLEASE post ALL replies to newsgroup!


Quote:
> I've got a program that loads and uses several forms. When I have a
> form that is hidden, it can still be accessed. Is there a way to keep
> a form from loading(besides hiding it) until it is told to load? If
> so, is there a way to check if the form has been loaded yet?
> Thanx
> Jason



Sat, 22 Sep 2001 03:00:00 GMT  
 Forms
Just a theoretical queston (I didn't test this), but wouldn't referencing
frmTest in your code ...

Quote:
>    If frmLoaded Is frmTest Then

... also load frmTest, defeating the purpose?  Or if it is not loaded, will
frmTest be "Nothing" (which means it will fail all tests)?  I tend to use the
safer "TypeName" function instead like this:

    If TypeName(frmLoaded) = "frmTest" Then

Or does your condition set the frmTest variable to something (instantiates and
initializes it), but does not "load" it, therefore it won't appear in the Forms
colleciton?

Just some thoughts,

-Rob Hajicek
 SevenStar technologies

______________________________________________________________________

SEVENSTAR TECHNOLOGIES * PO Box 937 * St. Louis, MO 63011-0937

**** Our STARPRINT/VB code print program is FREE when you download...
**** ...our 30-day trial of OBJECT BRIEFCASE for VB 6.0 and VB 5.0.
**** OBJECT BRIEFCASE is A PROFESSIONAL control & code library add-in!
**** Create your own code wizards!  Add error handling to your code!
**** Trial version at: http://www.SevenStarTech.com/download.htm
______________________________________________________________________

Quote:

> Jason,

> If you reference a built-in property or method of a form it will
> automatically load. However, you can assign it your own properties and
> reference these without the form loading (it will initialize though). I am
> not sure if this is what you are after. As for the checking of whether a
> form has been loaded, you can traverse through the Forms collection to see
> if it's in there. The Forms collection only holds loaded forms, whether they
> are shown or not.

> Dim frmLoaded As Form

> For Each frmLoaded in Forms
>     If frmLoaded Is frmTest Then
> ...
> Next

> Just replace frmTest with the name of your form.

> --
> HTH
> VB-Joker

> PLEASE post ALL replies to newsgroup!



> > I've got a program that loads and uses several forms. When I have a
> > form that is hidden, it can still be accessed. Is there a way to keep
> > a form from loading(besides hiding it) until it is told to load? If
> > so, is there a way to check if the form has been loaded yet?
> > Thanx
> > Jason



Sat, 22 Sep 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. custom form control: Cannot view design view of forms that inherit this form

2. Open form, close form, open form = disposed object exception

3. load another form form one form

4. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

5. form VB form to web based form

6. Forms Forms Forms

7. Making a form a child form of an MDI form

8. Forms Collection: Using it to Open Forms by Passing the Form Name as a String Variable

9. passing focus info form form to form

10. Clicking on a form, the whole form, and nothing but the form

11. Making a form a child form of an MDI form

12. Clicking on a form, the whole form, and nothing but the form

 

 
Powered by phpBB® Forum Software