Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检测我的VB.NET应用程序中的活动元素是否是文本框?
VB.NET
Me.ActiveControl接着?
Me.ActiveControl
You can use TypeOf:
TypeOf
Dim isATextBox As Boolean = TypeOf Me.ActiveControl Is TextBox
另一种方法是
If Me.ActiveControl.GetType() Is GetType(System.Windows.Forms.TextBox) Then ' do stuff End If