i want to create given number of textboxes during runtime how to write code for it
kavimani
Printable View
i want to create given number of textboxes during runtime how to write code for it
kavimani
Welcome to the forums :wave:
Here's a simple sample:Code:Option Explicit
Private Sub Form_Load()
AddTextBoxes 5
End Sub
Private Sub AddTextBoxes(number As Integer)
Static x As Single
Dim i As Integer
Dim txt As TextBox
For i = 1 To number
Set txt = Me.Controls.Add("VB.TextBox", "txt" & i)
If x = 0 Then
x = 200
Else
x = x + 200 + 200
End If
txt.Move 200, x, 2000, 200
txt.Visible = True
Set txt = Nothing
Next i
End Sub
Here is an example to play with.