CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Press ENTER instead of TAB to go to next text Box

    how can you move to another text box just by pressing ENTER instead of the TAB key


  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Press ENTER instead of TAB to go to next text Box

    Make the text box multiline
    Then in the _KeyPress event add this code

    private text1_keypress(keycode as integer...)
    if keycode = vbkeyreturn then
    keycode = 0
    SendKeys vbkeytab ' or the correct syntax
    end if
    end sub
    private text1_keyup(keycode as integer...)
    if keycode = vbkeyreturn then
    keycode = 0
    end if
    end sub



    However this works only for singleline text boxes.

    RK

  3. #3
    Join Date
    Aug 1999
    Location
    India-Delhi
    Posts
    106

    Re: Press ENTER instead of TAB to go to next text Box

    Hi,
    Use the following code:

    private Sub Text1_KeyDown(KeyCode as Integer, Shift as Integer)
    if KeyCode = vbKeyReturn then
    text2.setfocus
    end if
    End Sub



    I hope this works!!!
    regards,
    Santulan


    Santulan

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