Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Create new label with code

Posted on 2004-04-02
7
Medium Priority
?
171 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 180 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

609 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