我希望有一个部分类来管理我在radtextboxes
用户按下回车键和我正在寻找这行代码的 Telerik 解释之间的焦点tbs(i).KeyDown += New KeyEventHandler(AddressOf textBoxes_KeyDown)
任何想法。请帮忙。
Partial Public Class MstFileTruck Inherits Form
Private tbs() As Telerik.WinControls.UI.RadTextBox
Public Sub New()
InitializeComponent()
tbs = New Telerik.WinControls.UI.RadTextBox() {txtTruckNumber, txtRegistrationNumber, txtOwnerName}
For i As Integer = 0 To tbs.Length - 1
tbs(i).Tag = i
tbs(i).KeyDown += New KeyEventHandler(AddressOf textBoxes_KeyDown)
' 'tbs(i).IsHandleCreated += New KeyEventArgs(Keys.Enter) '(AddressOf textBoxes_KeyDown)
' tbs(i).RootElement.KeyDownEvent.EventName(textBoxes_KeyDown) '= New KeyEventArgs(AddressOf Telerik.WinControls.UI.RadTextBoxElement.KeyDownEvent.EventName(textBoxes_KeyDown(tbs, RootRadElement.KeyDownEvent))) '(AddressOf textBoxes_KeyDown)
Next
tbs(0).Focus()
End Sub
Private Sub textBoxes_KeyDown(sender As Object, e As KeyEventArgs)
Dim tb As Telerik.WinControls.UI.RadTextBox = TryCast(sender, Telerik.WinControls.UI.RadTextBox)
If tb IsNot Nothing Then
If e.KeyCode = Keys.Enter Then
Dim tag As Integer = CInt(tb.Tag)
If tag = 2 Then
tbs(0).Focus()
Else
tbs(tag + 1).Focus()
End If
End If
End If
End Sub
End Class