Mantas Daškevičius
Mantas Daškevičius

Reputation: 324

How Visual Basic 6 VB.Global.Load Sub works?

I have a problem: one of the forms in my project takes long time to load. Situation: With using debugger I go through code. When I reach row with Load frmTest (there is a specific form) it takes about 1.5 - 2 seconds to continue in Form_Load handler.

I tried to search for some documentation, but failed... well at least finding any information about what Load Sub does before Form Load event triggers.

So, how does the VB.Global.Load work?

VB6 IDE Object browser VB.Global

Upvotes: 1

Views: 540

Answers (3)

Mantas Daškevičius
Mantas Daškevičius

Reputation: 324

Thanks @Alex K. for the answer:

The biggest job it does it to initialize all the controls/activex components sited on the form (or anything in the global scope declared As New) so if you have any third party ones then that's something to investigate.

Upvotes: 0

scor4er
scor4er

Reputation: 1589

There're so many things that can go wrong.

That's how I would analyze this case.

  1. Check if you have Form_Initialize method, if not - create it and check if delay's before or after this method's call.
  2. Check if you have any private fields on a form level. If there're heavy objects there they may be initialized before the form Load and it may take the time. Especially actual for the COM objects.
  3. If this happens for a single form only I would try to understand what's so special about this exact form and if needed remove everything to the ground to detect the problem.

Upvotes: 1

John Eason
John Eason

Reputation: 571

Assuming this is VB6 (never heard of 'VB.Global.Load' in that context), see Life Cycle of Visual Basic Forms

Upvotes: 0

Related Questions