Solved

Dynamic addition of controls to a control.

Posted on 1999-01-25
3
149 Views
Last Modified: 2010-05-03
I have created a User-Defined control.  I want to add an array of standard VB Shape controls to my User-Defined control dynamically.  For example,  I want to display an array of multicolored rectangles on my User-Defined control.  I don't know how many rectangles are in the array until the user tells me.   Possible?  If so how?

0
Comment
Question by:nelchr
[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
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 200 total points
ID: 1470577
Place a control named Shape1 on the usercontrol. Set its index property to 0. Then, to add a control, call Load Shape1(1), Load Shape1(2) and so on. After each call, set the .Visible property to true, and reposition the shape (or it can be any other control) using .Left and .Top properties. This is called a control array
0
 

Author Comment

by:nelchr
ID: 1470578
When I do what you suggest I get a subscript out of range on the first addition.  i.e. shape1(1) in your example.  I tried to REdim the array first to its full size but that didn't help.    It looks like you are close but ...
0
 

Author Comment

by:nelchr
ID: 1470579
ok, ok, ok  I got it.  Thanks for your help.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

628 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