Start New Discussion within our Software Development Community

Hi. This may seem simple to most but has consumed 3 days so far and a bit of $$ trying to learn simple how to use Enter as a Tab (Yes I know it is a Fau-par but I need it regardless).

The idea is to move the focus to the next TextBox (don't worry about the Case 38, 58 etc too much I).

I have 6 large books on VB.NET 2003 and have been googling for days with no joy.

Please help. Thank you.

My Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'(Unrelated code here)

AddHandler Form1.KeyDown, AddressOf EnterkeyHandler 'Would like to understand this better
End Sub

Private Sub EnterkeyHandler(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter Then MsgBox("Enter Working")
        TextBox = TextBox + 1
        If TextBox = 18 Or TextBox = 38 Or TextBox = 58 Or TextBox = 78 Then
            Select Case TextBox
                Case 18
                    TextBox = 21
                Case 38
                    TextBox = 41
                Case 58
                    TextBox = 61
                Case 78
                    TextBox = 1
            End Select
        End If
        If Forward = True Then
            Call FwdFieldEntries()
        Else
            Call RevFieldEntries()
        End If
        e.Handled = True 'Must be within A Handle Event to avoid "not handling the event, you are simply overriding it"
    End Sub
    Private Sub FwdFieldEntries()

        Select Case TextBox
            Case 1
                tbxTestNº1.Focus()
            Case 2
                tbxSampleNº1.Focus()
            Case 3
                tbxFinMassBotS.Focus()
This article has been dead for over six months. Start a new discussion instead.