Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What's the difference between .show and Load?

Posted on 1999-07-06
5
Medium Priority
?
1,922 Views
Last Modified: 2008-03-04
What's the difference between .show and Load?

<formname>.show and load <formname>

Thank you.
0
Comment
Question by:iamjhkang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
Jedi earned 80 total points
ID: 1522173
Hi,
When the show method is called, the form is loaded if needed (if the form is not loaded) and then displayed(showed).
When load is used the form is just loaded(the form load is executed) not displayed(showed).

Typicallly you can load all forms in an application during a spash screen to  and then And then call show and hide to display and undisplay the forms to make the application appair faster.

//Jedi
0
 
LVL 1

Expert Comment

by:db_tiger
ID: 1522174
Ooups, I wnated to answer it - so I give it as a comment!

A Form has to be loaded, before it can be shown.

You do not always recognize this, because VB automatic loads a Form, whren you call the Show-Method.

You can Hide a form, and the form is still loaded: You can see this, by i.e. changing the caption of a label: Perhaps you call

(Form1.Load) (may be ommitted, is automatically called)
Form1.Show
Form1.Hide
Label1.Caption = "changed Label"

where Label1 lies on Form1.

If you call now Form1.Show, you'll see the changed Caption.
But if you Unload Form1 and then try to talk to any of the objects, variables etc. owned by this form, you'll get an error.

You can hide and show a form, if you have to set some values on the form, although the user should actually not see the form.

If you Unload a Form, you free the memory, that is better regardfing the point of performance.
If you Unload a Form, it is definitely finished. You normally do this, if you do not need it any more or if you'll need it again, but as a new initialized version.

I.E. a MessageBox is a form that is always loaded, shown and unloaded. It is only used one and goes away after beeing used.

There are other Events as Terminate, QueryUnload, Activate, which should to be considered. That best way is to write a sample application, with two forms, where you use Labels on the first form, which gets their captions from the different Events on the second Form i.e. Form_Load, Form_Unload, Form_Show - like that you'll see there occurence.

Good Luck and ask again, if needed
db




0
 
LVL 1

Author Comment

by:iamjhkang
ID: 1522175
Thank you Jedy and db_tiger.

I got it.

Jedy!
By just LOADing a form W/O SHOW I can see the form.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1522176
Try using an object variable

Dim objX As YourForm

Set objX = New YourForm
0
 
LVL 1

Author Comment

by:iamjhkang
ID: 1522177
Thank you.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question