Re: vb6 cloning a component on another form




<astroboyfusion@xxxxxxxxxxxx> wrote
I'm running out of controls on my main form (form1). So I've devised a plan
to store the controls in another form(form2), and have it's contents loaded
on the main form when required, then release it from memory afterwards.

Chances are you are not running out of controls. That is really a non-sequitur.
You may be running out of control names, however, since the number of the
different names is limited....

I would suggest you would be better served if you made a control array out
of every type of control you need to use, and then load the controls as needed
and remove them from memory when convienent.

Control array indexing does not need to be contigious such that you can
assign indexes in the range of 100-199 for tab 1, 200-299 for tab 2,
300-399 for tab 3, and so on. The controls can then be left in memory
for frequently used tabs, or removed from memory if desired....

Thus you might see Buttons(100) and know that it is the first push button
on tab 1, or see Texts(302) and know it is the third textbox on the third
tab.

Of course, using a class to wrap up the code for the individual tabs would
make for a neater design....

LFS


.


Loading