Vb.NET - Create Dynamic TextBox



Creates a new instance of a Windows forms TextBox control at run time.

Add a Windows Forms Control at Run Time
'Assembly: System.Drawing.dll
'Assembly: System.Windows.Forms.dll
'Assembly: System.dll

'Namespace: Microsoft.VisualBasic
'Namespace: System
'Namespace: System.Drawing
'Namespace: System.Windows.Forms

     'declare any control type as same 
      Dim controlName As New TextBox()
        With controlName
          'specify the co-ordinates 
            .Location = New Point(23, 32)
            .Size = New Size(Width, Height)
            .TabIndex = TabIndex
            .Text = Text
        End With
        Controls.Add(controlName)


Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.