Solved

Create new label with code

Posted on 2004-04-02
7
168 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 86

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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
Paint/Redraw window while dragging 16 88
Copy a row 12 70
MS SQL Update query with connected table data 3 65
backup program with robocopy 6 76
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.
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…
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…

696 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