• 0
Sign in to follow this  



Como eu faço para criar varias labels em tempo de execução

Tipo não sei quantas label eu preciso posso precisar de 5 6 7 então gostaria de saber se há uma maneira de criar elas quando o form for carregado

Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

já resolvi minha duvida bastaria apenas fazer isso

Option Explicit
Dim WithEvents Label1 As Label
Dim WithEvents Label2 As Label
Dim WithEvents Label3 As Label
Dim WithEvents Label4 As Label
Dim WithEvents Label5 As Label

Private Sub Form_Load()

Set Label1 = Form1.Controls.Add("VB.Label", "Label1")
Set Label2 = Form1.Controls.Add("VB.Label", "Label2")
Set Label3 = Form1.Controls.Add("VB.Label", "Label3")
Set Label4 = Form1.Controls.Add("VB.Label", "Label4")
Set Label5 = Form1.Controls.Add("VB.Label", "Label5")

Label1.Visible = True
Label1.Top = 500
Label1.Left = 500
Label1.Caption = "eee"

Label2.Visible = True
Label2.Top = 500
Label2.Left = 500

Label3.Visible = True
Label3.Top = 500
Label3.Left = 500

Label4.Visible = True
Label4.Top = 500
Label4.Left = 500

Label5.Visible = True
Label5.Top = 500
Label5.Left = 500

End Sub

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this