Experts Exchange connects you with the people and services you need so you can get back to work.
Public Class Form1
Private TextBoxes As New List(Of TextBox)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i As Integer = 1 To 10
Dim tb As New TextBox
tb.Name = "MyTextBox" & i
tb.Text = "TextBox #" & i
AddHandler tb.Click, AddressOf TB_Click
Private Sub TB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim TB As TextBox = CType(sender, TextBox)
MessageBox.Show("TextBox Name: " & TB.Name & vbCrLf & "TextBox Text: " & TB.Text)
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.