sender Is (control) with Option Strict On
13-Jul-0909 Leave a comment
Select Case True
Case sender Is TextBox1
Label1.Text = TextBox1.Text
Case sender Is TextBox2
Label1.Text = TextBox2.Text
End Select
However, this translates into IL (and decompiled using Reflector) as:
Dim flag1 As Boolean = True
If (flag1 = (sender Is Me.TextBox1)) Then
Me.Label1.Text = Me.TextBox1.Text
Else
If (flag1 = (sender Is Me.TextBox2)) Then
Me.Label1.Text = Me.TextBox2.Text
End If
End If
I don’t know if this helps.