Solved

Create new label with code

Posted on 2004-04-02
7
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

691 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