Solved

Load picturebox with label controls inside

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Window placement 17 74
String manipulation in Visual Basic 7 58
Prevent checkbox click event occur while editing it in vb6 8 32
Advice in Xamarin 21 47
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

929 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

10 Experts available now in Live!

Get 1:1 Help Now