Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello

 

When I have for example 2 textboxes: TextBox1 and Textbox2

Now is i an integer with the value 1 or 2.

Which syntax I require to call:

TextBoxi.Text


   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       active(1)
   End Sub

   Private Sub active(ByVal i As Integer)
       TextBox & "i".Text = "Hello")
   End Sub

  • *Experts*
Posted

You need to go through all controls on the form and look for the textbox:

Dim ctrl As Control
For Each ctrl in Me.Controls
   If TypeOf ctrl Is TextBox Then
       If ctrl.Name = "TextBox" & i Then
            'do something to that textbox
       End If
   End If
Next

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...