Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having an issue with the load statement

Status
Not open for further replies.

ShawnCoutts

Programmer
Jul 4, 2006
74
CA
I have an application that uses several forms during the course of running. When I try to manually load any of these forms visual basic gives me the error:

"Invalid Use of Property"

the code for loading looks like this:
Code:
Load KeyForm
Load FileForm
Load ListForm

from everything that I have looked at, including various posts, and the VB documentation, this should work

Please someone explain to me what is happening
 
Load" runs the form's Load event but doesn't display the form. The error message is probably coming from something in the form's Form_Load event and not from the Load command itself.

Try using
Code:
KeyForm.Show
FileForm.Show
ListForm.Show
which both loads the form and displays it.
 
thanks, that was what I was originally doing. It seems to work so Ill stick with it.

Thanks again
 
Shawn, to this clarify the practical difference between the two approaches: you would use Load instead of Show when you want to assign any performance hit that loading the form entails, without actually showing the form. For example, you have, say, two forms, each of which has an associated disconnected recordset. The recordset gets populated during the load event. You might want to have the second form's recordset get populated when the user first opens the application, rather than the first time the user navigates to the second form.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top