by AKR (3 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 15th October 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Create control dyamically using array
' On the Form,
' Place a Label and change its index to 0
' Place a Textbox and change its index to 0
' -------------------------------------------
Private Sub Form_Load()
Dim Captions(4) As String
Dim Sizes(4) As Integer
Captions(1) = "1"
Captions(2) = "2"
Captions(3) = "3"
Captions(4) = "4"
Sizes(1) = 20
Sizes(1) = 30
Sizes(1) = 40
Sizes(1) = 15
Sizes(1) = 12
For i = 1 To 4
Load Label1(i)
Load Text1(i)
Label1(i).Top = Label1(i - 1).Top + 500
Label1(i).Left = Label1(0).Left
Text1(i).Top = Text1(i - 1).Top + 500
Text1(i).Left = Text1(0).Left
Label1(i).Caption = i
Text1(i).Text = i
Label1(i).Visible = True
Text1(i).Visible = True
Next i
End Sub