Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Load picturebox with label controls inside

Posted on 2003-10-28
1
Medium Priority
?
353 Views
Last Modified: 2013-12-25
Hi,

In design time, I have created a picturebox control with a couple of label controls inside.

In execution time, I have to create more pictureboxes with the labels included. If I try to Load the picturebox with the load method:

Load Picturebox(1)

the labels in the picturebox aren't created. If I also create the labels:

Load Picturebox(1)
Load Label1(1)
Load Label2(1)

the labels are created inside of Picturebox(0).

Can you help me?
0
Comment
Question by:Kubilay74
[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
1 Comment
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 9634368
Hi Kubilay74,

Private Sub GetNewPB()
    Load Picture1(Picture1.UBound + 1)
    With Picture1(Picture1.UBound)
        .Visible = True
        .Left = Picture1(Picture1.UBound - 1).Left + Picture1(Picture1.UBound - 1).Width + 100
        .Top = Picture1(Picture1.UBound - 1).Top
    End With
    Load Label1(Label1.UBound + 1)
    Load Label2(Label2.UBound + 1)
    With Label1(Label1.UBound)
        .Visible = True
        Set .Container = Picture1(Picture1.UBound)
    End With
    With Label2(Label2.UBound)
        .Visible = True
        Set .Container = Picture1(Picture1.UBound)
    End With
End Sub

This procedure will create new instance of picture box, align it to the right of the previous one and ensure that the correct instances of the label control(s) are placed within it.

Tim Cottee MCSD, MCDBA, CPIM
Brainbench MVP for Visual Basic
http://www.brainbench.com
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

609 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