Solved

Load picturebox with label controls inside

Posted on 2003-10-28
1
342 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 25 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

734 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