alanka_kishore
alanka_kishore

Reputation: 27

How to Assign the text for Dynamic loaded Textbox Array in Visual Basic?

How to Assign the text for Dynamic loaded Textbox Array in Visual Basic..

Dim txtStage1() As TextBox

ReDim Preserve txtStage1(2)

txtStage1(1).Text ="New"

I am getting error in at txtStage1(1).Text ="New" Line..

Can any one help me...

Upvotes: 0

Views: 4155

Answers (1)

alanka_kishore
alanka_kishore

Reputation: 27

I have found the answer to my question.

Place a TextBox on the form and name it txtarray. Set the Index property of the TextBox to 0.

Private Sub Form_Load()
    Dim i As Integer

    txtArray(0).Text = "0"

    For i = 1 To 5
        Load txtArray(i)

        With txtArray(i)
            .Text = i
            .Visible = True
            .Top = txtArray(i - 1).Top + 550
        End With
    Next i
End Sub

Upvotes: 1

Related Questions