This is a migrated thread and some comments may be shown as answers.

moving to next radtextbox control when someone presses enter

0 Answers 126 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Tendai
Top achievements
Rank 1
Tendai asked on 07 Jun 2012, 10:55 AM
I am trying to use the following code to move to other controls every time someone presses Enter but this code seems to require some changes to function with telerik radtextbox especially the following line "tbs(i).KeyDown += New KeyEventHandler(AddressOf textBoxes_KeyDown)". How can I trnslate this line into telerik
Public Partial Class Form1
Inherits Form
Private tbs As TextBox()
Public Sub New()
InitializeComponent()
tbs = New TextBox() {textBox1, textBox2, textBox3}
For i As Integer = 0 To tbs.Length - 1
tbs(i).Tag = i
tbs(i).KeyDown += New KeyEventHandler(AddressOf textBoxes_KeyDown)
Next
tbs(0).Focus()
End Sub
Private Sub textBoxes_KeyDown(sender As Object, e As KeyEventArgs)
Dim tb As TextBox = TryCast(sender, TextBox)
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

No answers yet. Maybe you can help?

Tags
TextBox
Asked by
Tendai
Top achievements
Rank 1
Share this question
or