Question creating textbox at runtime

joe_1980

New member
Joined
Aug 12, 2008
Messages
2
Programming Experience
Beginner
hi to everybody, i new to vb.net. I need to create textboxes at runtime as per the customer requirement and then concatenate all the texts of these generated textboxes into an existing textbox. here is my code. Note that it is on a tab control

VB.NET:
PPublic Class frmSuggestion
    Public Class MyTextBox
        Inherits System.Windows.Forms.TextBox
    End Class

    Private Sub BtnNewSuggestion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNewSuggestion.Click
        Static num As Integer

        num += 1
        If num < 7 Then
            ReDim TextBoxes(num)
            TextBoxes(num - 1) = New MyTextBox()
            With TextBoxes(num - 1)
                .Name = "TxtNewSuggestion" & num
                .Width = 238
                .Height = 20
                .Location = New System.Drawing.Point(56, (num * (.Height + 5) + 186))
            End With

            Me.TpAction.Controls.AddRange(New System.Windows.Forms.Control() {TextBoxes(num - 1)})

        End If
    End Sub
End Class

these code are working but i don't know how to collect the data in the generated textboxes and put it in suppose textbox1. if someone could help me please
 
Back
Top