Activefrom problem

baddy
09-12-2000, 04:12 AM
I have being working with MDI form and child forms lately. But the problem is that when access the child forms by clicking buttons on the MDI form, the child forms take some time to load up. This is very undesirable.
How do I make use of the activeform property to resolve this?
Currently my MDI form serves as a main menu, with buttons that show the child forms upon initiation. So When I click a button, I will use n.show to show the child form.

BillSoo
09-12-2000, 04:34 AM
I'm not sure what you mean when you refer to the activeform property of the MDI form.

In any case, child forms cannot be loaded and hidden (as non-child forms can). It *may* be possible to do something like that by changing the window properties of the form using the SetWindowLong API call but I can't confirm that since I'm away from my references at the moment.

I think your best bet is to revamp your forms to reduce their size. For instance, use label controls instead of textboxes when you don't need user input. Use image controls instead of picture boxes where possible etc. I believe that making arrays of controls instead of individual controls also helps. I also use a third party control, vsOCX from videosoft. The elastic control in this OCX allows me to get rid of all the label controls on my form.

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

whelanp
09-12-2000, 04:39 AM
The "slowness" problem of your child forms can be due to a number of factors, eg

The number of controls on the form.

The amount of processing involved in the Form_Load event.


There are a number of ways around this, check out the HELP for optimising forms.


Also you could put the the following on each form load event.

me.show
DoEvents
me.mousepointer = vbHourglass

This will allow the user to see the form while the startup code is running. Don't forget to re-set the mouse pointer.

baddy
09-12-2000, 04:42 AM
Allow me to clarify... I believe a child form does not need to be loadedm am I right? So when I have many child forms, I must have a way to determine which one I have control over. But now instead of doing this, I am using show method to allow me access to the respective child form.

whelanp
09-12-2000, 04:56 AM
When you issue the Show command you are in effect loading the form.

BillSoo
09-12-2000, 04:59 AM
The show command makes the childform active. If it isn't already loaded, it loads it first. So there should be no problem in using the show command.

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

baddy
09-12-2000, 05:15 AM
but by using the show method, the loading of the file is slower. I tried using 1 child form alone,without using the show method. The form is loaded almost instantaneously. So how should I go about with multiple child forms?
I would appreciate if anyone can teach me the usage of activeform and activecontrol.

BillSoo
09-12-2000, 12:34 PM
So if you didn't use the show method, how did you load it? Not that it's difficult; even referring to any control on the form will load it.

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

Derek Stone
09-12-2000, 05:11 PM
Here is the basic reason why it is taking so long to load the forms:
MEMORY AND PROCESSOR SPEED
The more memory and processor speed have the faster the forms are going to show.
You can't control this unless you add more.
Nevermind the fact that if you have a lot of controls on the form it will also take longer.
You don't have many options, so use the hourglass method like mentioned above.
Good Luck

-cl

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum