Solved

Create new label with code

Posted on 2004-04-02
7
167 Views
Last Modified: 2012-05-04
ok I have Label1(0) Label1(1) and I wanna have Label1(2) made by code, like if I push button command1 it makes
a new label, named Label1(2) for me. is that possible?

0
Comment
Question by:jozne
7 Comments
 
LVL 6

Expert Comment

by:PhilAI
ID: 10739536
This statement loads controls

Load Label1(2)

The do with it what you will... for example

Label1(2).Caption = "New Label"

================================

Load more than one example:

Dim L As Long

For L = 2 To 5
    Load Label1(L)
Next L
0
 
LVL 3

Expert Comment

by:Bobeo
ID: 10739645
Remember that the new label will load into the same position as label1(0) so you also need to change the location settings

label1(L).left =
label1(L).Top =

etc
0
 
LVL 19

Accepted Solution

by:
BrianGEFF719 earned 45 total points
ID: 10739824

set x as new label1
x.top = 0
x.left = 0
x.caption = "Hello"
x.visible = true
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 10740785
Here is some generic code that shows an easy way to always load up another label.  Each time the button is pushed, another lable will appear directly below the previous one.

Private Sub Command1_Click()
    Load Label1(Label1.Count)
    Label1(Label1.UBound).Top = Label1(0).Top + (Label1.Count - 1) * Label1(0).Height
    Label1(Label1.UBound).Visible = True
End Sub

Idle_Mind
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

839 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