Solved

Create new label with code

Posted on 2004-04-02
7
162 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
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 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…

743 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

16 Experts available now in Live!

Get 1:1 Help Now