Creating Control Arrays At Run Time 
Author Message
 Creating Control Arrays At Run Time

Does anyone know how to add a control array to a form at run time? I know how
to add a control at run time if it is not on the form. I also know how to add a
contol to an existing control array if I hardcode the control name. However I
can not add a control array dynamically at run time or add a control to an
existing control array when all I have is a string variable with the name of
the control. If I use the following statemment in a loop, I get an error to the
effect that the control already exists the second time through.

   frmEditForm.Controls.Add "VB.Label", "lbl_Approve"

also you can not do this :

   Load "lbl_Approve"

The problem I have is I have a series of index = 0 control arrays on a form at
design time. I want to add controls to the control array dynamically at run
time. However, I do not want to program a condition for each control array to
add the elements ala the Load command. I want to be able to click on the
index=0 control pass the name to a procedure that will dynamically load in
additional controls based on the control I clicked on. I can not use the load
command because all I have is a string with the control's name. The
Controls.Add would appear to work except I can not figure out how to use it add
controls to an existing control array or even create a control array

I know I could hard code this in and I have left out some implimentation issues
that force me to go ths way. However I need to find a way to load controls into
a control array on the form dynamically when all I know is the name and class
of the control. There must be a way.

Sat, 01 Sep 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Creating control arrays at run time?

2. VB6 - Creating Control Array at Run Time

3. Creating controls in a control array at run-time

4. Creating control arrays at run-time - is this possible?

5. create & add controls array in run time

6. Creating Controls at Run time using Collections not Arrays

7. Create Control Array and add item at run time

8. create a control array at run time

9. Creating array of controls at run time

10. Adding elements to a control array of Menu items with subMenus at Run time

11. control arrays at run time

12. Run time error 340 - control array element does not exist


Powered by phpBB® Forum Software