Solved

Load picturebox with label controls inside

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

18 Experts available now in Live!

Get 1:1 Help Now