| View previous topic :: View next topic |
| Author |
Message |
mt_reilly Newbie
Joined: 13 Nov 2003 Posts: 3
|
Posted: Nov 13th, 2003 02:32 PM Post subject: Creating Labels with Code |
|
|
I am trying to create Labels with Code, rather than using the tool bar and drawing them with a mouse. I've tried the code below, but this resulted in a run-time error 91. Any suggestions on how to do this?
Private Sub Form_Load()
Dim lbl() As label
ReDim lbl(3)
For i = 1 To 3
With lbl(i)
.Height = 30
.Width = 30
.Caption = i
.Left = 300 * i
End With
Next i
End Sub |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Nov 14th, 2003 04:19 PM Post subject: |
|
|
You can't make a control array the way Avis pointed out. The index property isn't set and you can't set it at runtime. If you want a control array you have to set it at design time. _________________ No one is completely useless. They can at least be an example of what to avoid. |
|
| Back to top |
|
|