i've got this code to create a textbox using a command button but i can't understand anything of it , please can you explain what each word especially(set, prevtextcontrol ,controlid) mean and what each line mean, here is the code :
Code:
Private Sub Command1_Click()
Dim TextControl As TextBox
Dim PrevTextControl As TextBox
ControlID = ControlID + 1
Set TextControl = Form1.Controls.Add("Vb.TextBox", "Text" & ControlID)
If (ControlID > 1) Then
Set PrevTextControl = Form1.Controls("Text" & (ControlID - 1))
Else
Set PrevTextControl = TextControl
End If
With TextControl
.Left = (PrevTextControl.Left + PrevTextControl.Width) + 10
.Top = 20
.Width = 50
.Height = 20
.Visible = True
End With
End Sub
Comment