Solved

Dynamic addition of controls to a control.

Posted on 1999-01-25
3
143 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
  • 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now