Reputation: 4173
How can I detect if the active element in my VB.NET
app is a Textbox?
Me.ActiveControl
and then?
Upvotes: 1
Views: 1226
Reputation: 1206
Another way would be
If Me.ActiveControl.GetType() Is GetType(System.Windows.Forms.TextBox) Then
' do stuff
End If
Upvotes: 1
Reputation:
You can use TypeOf
:
Dim isATextBox As Boolean = TypeOf Me.ActiveControl Is TextBox
Upvotes: 1