CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    33

    Hitting enter to move to the next input box

    Hi I have a Control Array of 4 text input boxes. I want to have the user hit enter on each one and as a result have the focus move to the next... then finally on "submit data".

    How can I do this?

    Any help appreciated!
    Thanks.
    Pat


  2. #2
    Join Date
    Aug 2000
    Location
    KY
    Posts
    766

    Re: Hitting enter to move to the next input box

    I think this is what you are looking for, in the keypress event trap that the control arrays index is not the last item else move to the next item


    private Sub Text1_KeyPress(Index as Integer, KeyAscii as Integer)
    If Index = Text1.UBound then
    'Do Your Submit
    Exit Sub
    End If

    Select Case KeyAscii
    Case 13
    Text1(Index + 1).SetFocus
    End Select

    End Sub






Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured