Solved

Load picturebox with label controls inside

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 64
Notepad++ how to remove delimiter : from beggning of the line? 3 114
vb6 - Transfer from MSHFlexgrid1 to xls issue 8 56
Advice in Xamarin 21 97
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

820 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