U General forme deklarisi promjenjivu NoTextBox tipa Integer
Primjer 1.
Na formu postavi jedan textbox i Index mu postavi 0
Code:
NoTextBox = NoTextBox + 1
Load Text1(NoTextBox)
With Text1(NoTextBox)
.Left = Text1.Item(NoTextBox - 1).Left
.Top = Text1.Item(NoTextBox - 1).Top + _
Text1.Item(NoTextBox - 1).Height + 100
.Height = Text1.Item(NoTextBox - 1).Height
.Width = Text1.Item(NoTextBox - 1).Width
.Text = .Name
.Visible = True
Primjer 2.
Code:
Dim nCtrl As Control
Dim sFofmName As String
Dim sTextName As String
NoTextBox = NoTextBox + 1
sTextName = "Text" & NoTextBox
Set nCtrl = Me.Controls.Add("VB.TextBox", sTextName, Me)
With nCtrl
.Left = 200
.Top = (NoTextBox * 700) + 200
.Height = 500
.Width = 1400
.Text = .Name
.Visible = True
End With
Set nCtrl = Nothing