Hi, guys!
I'm in trouble with it...
I created an array of command buttons (for instance), at runtime, and I need to know which was clicked...
But when I click anyone I have no answer...
What's going on ?
Follows the code where I create the array of command Buttons:
VB Code:
Option Explicit Dim lbl(4) As Label Private Sub lbl1_Click() MsgBox chkbox.Name End Sub Private Sub Form_Load() Dim x As Byte For x = 0 To 4 Set lbl(x) = Me.Controls.Add("VB.Label", "lbl" & Me.Controls.Count) '& "(" & x - 1 & ")") With lbl(x) .Left = 1000 .Top = 500 * x .Width = 2000 .Height = 500 .Caption = lbl(x).Name .Visible = True End With Next x End Sub Private Sub Form_Unload(Cancel As Integer) Dim i As Integer For i = 0 To 4 Set lbl(i) = Nothing Next i End Sub
tks!
João Luiz








Reply With Quote