使用VB 2017。 我有一个从“很多”文本框填充的表单。为了管理它们,我创建了以下代码:
Private enCellBiger As IEnumerable(Of TextBox)
…………………………………….
enCellBiger = From textbox In Me.Controls.OfType(Of TextBox)()
Where textbox.Name.Substring(2, 8) = "_TextBox"
Order By textbox.Name
For Each BigEnmrtdID In enCellBiger
AddHandler BigEnmrtdID.PreviewKeyDown, AddressOf BigPrvwKeyDwn
AddHandler BigEnmrtdID.KeyDown, AddressOf BigKeyDwn
AddHandler BigEnmrtdID.KeyPress, AddressOf BigKeyPrss
AddHandler BigEnmrtdID.Enter, AddressOf BigEnter
AddHandler BigEnmrtdID.Leave, AddressOf BigLeave
AddHandler BigEnmrtdID.DoubleClick, AddressOf Big2Click
Next
………………………………….
Private Sub BigPrvwKeyDwn(sender As Object, e As PreviewKeyDownEventArgs)
Select Case (e.KeyCode)
Case Keys.Down, Keys.Up, Keys.Left, Keys.Right, Keys.Tab
e.IsInputKey = True
End Select
End Sub
……………………………………………….
Private Sub BigKeyDwn(sender As Object, e As KeyEventArgs)
Select Case (e.KeyCode)
Case Keys.Back
…………
Case Keys.Tab, Keys.Down, Keys.Up, Keys.Left, Keys.Right
…………
Case Else
…………
End Select
End Sub
它可以按需工作。 现在,我需要扩展 Sub BigKeyDwn ,以跟踪重复按下的键“ 0”(零)。因此,我将代码修改如下:
Select Case (e.KeyCode)
Case Keys.Back
…………
Case Keys.Tab, Keys.Down, Keys.Up, Keys.Left, Keys.Right
…………
Case Keys.D0, Keys.NumPad0
If e.isrepeat Then
…………
End If
Case Else
…………
End Select
从e.isrepeat的调试器中,我得到信息“ isrepeat不是KeyEventArgs的成员”。 我无法理解和/或管理。有人可以帮忙吗?
请理解我不是VB专家
谢谢。