我是vb.net的新手我想验证文本框到禁用的shortcuts.shortcutenabled.false正在使用单个文本框,我想在我的表单中使用shortcutsenabled = false所有文本框,有人有想法吗?先感谢您 ! :d
我收到了这个错误:
shortcutsenabled is not a member of system.windows.forms.control
我的代码:
For Each alltxtbox As Control In Me.Controls
If TypeOf alltxtbox Is TextBox Then
alltxtbox.ShortcutsEnabled = False
End If
Next
答案 0 :(得分:0)
试试这段代码:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim ctrl As Control
For Each ctrl In Panel1.Controls
If (ctrl.GetType() Is GetType(TextBox)) Then
Dim tb As TextBox = CType(ctrl, TextBox)
tb.ShortcutsEnabled = False
End If
Next
End Sub
End Class