How to check the type of an object or control using VB.NET or C#

The VB.NET check up is:

If (TypeOf sender Is TextBox)Then
Dim txt As TextBox= DirectCast(sender, TextBox)
End If



And the C# code:

if (sender Is TextBox){
TextBox txt=(TextBox)sender;
}

No comments:

Post a Comment