moving to next radtextbox control when someone presses enter

1 posts, 0 answers
  1. Tendai
    Tendai avatar
    4 posts
    Member since:
    Feb 2012

    Posted 07 Jun 2012 Link to this post

    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()
    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)
    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(tag + 1).Focus()
    End If
    End If
    End If
    End Sub
    End Class
Back to Top