Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.2 kB
0
Indexable
Never
Option Strict On
Public Class Form1
    Private tb0 As New TextBox
    Private tb1 As New TextBox
    Private tb2 As New TextBox
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        tb0.Tag = " 0 "
        tb1.Tag = " 1 "
        tb2.Tag = " 2 "
        tb0.Location = New Point(10, 10)
        tb1.Location = New Point(10, 35)
        tb2.Location = New Point(10, 60)
        Controls.AddRange({tb0, tb1, tb2})
        AddHandler tb0.TextChanged, AddressOf TextBoxes_TextChanged
        AddHandler tb1.TextChanged, AddressOf TextBoxes_TextChanged
        AddHandler tb2.TextChanged, AddressOf TextBoxes_TextChanged
    End Sub
    Private Sub TextBoxes_TextChanged(sender As Object, e As EventArgs)
        Dim tb As TextBox = DirectCast(sender, TextBox)
        Select Case True
            Case tb Is tb0
                Debug.WriteLine("TextBox0: " & tb.Text & ":" & tb.Tag.ToString())
            Case tb Is tb1
                Debug.WriteLine("TextBox1: " & tb.Text & ":" & tb.Tag.ToString())
            Case tb Is tb2
                Debug.WriteLine("TextBox2: " & tb.Text & ":" & tb.Tag.ToString())
        End Select
    End Sub
End Class