1

如何检测我的VB.NET应用程序中的活动元素是否是文本框?

Me.ActiveControl接着?

4

2 回答 2

1

You can use TypeOf:

Dim isATextBox As Boolean = TypeOf Me.ActiveControl Is TextBox
于 2013-08-24T16:40:34.543 回答
1

另一种方法是

If Me.ActiveControl.GetType() Is GetType(System.Windows.Forms.TextBox) Then 
    ' do stuff
End If
于 2013-08-24T16:44:18.770 回答