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

Thread: VbReturnKey

  1. #1
    Join Date
    May 2000
    Posts
    47

    VbReturnKey

    is it possible to filter the keyboard to accept only numeric at the same time traping the vbreturnkey

    for example:

    Private Sub Text1_Keyup(Keycode As Integer, shift As Integer)
    Dim lstitem As ListItem
    If Keycode = vbKeyReturn Then SendKeys "{tab}"

    end sub

    thanks for any help.
    usin


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: VbReturnKey

    in order to trap Returns trap the KeyPress event and query the KeyAscii parameter for vbKeyReturn


  3. #3
    Join Date
    May 2000
    Posts
    47

    Re: VbReturnKey

    thanks for your reply,
    i tried to make the text2 respond to uparrowkey which is, when the uparrowkey is press the cursor will go up to the previous text1. can you help me solve this problem? the following code is not working for uparrowkey



    Private Sub text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 8 Or KeyAscii = 13 Then 'you can press backspace and enter (search the ascii code for enter key cannot find it now)
    SendKeys "{tab}"
    End If

    If KeyAscii < 48 Or KeyAscii > 57 Then
    Beep
    KeyAscii = 0
    End If

    End Sub


    Private Sub text2_KeyPress(KeyAscii As Integer)
    If KeyAscii = 8 Or KeyAscii = 13 Then 'you can press backspace and enter (search the ascii code for enter key cannot find it now)
    SendKeys "{tab}"
    End If

    If KeyAscii < 48 Or KeyAscii > 57 Then
    Beep
    KeyAscii = 0
    End If

    If KeyAscii = vbKeyUp Then SendKeys "+{tab}"

    End Sub


  4. #4
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Re: VbReturnKey

    If KeyAscii = vbKeyUp then text1.setfocus



    :-)

    Michael Vlastos
    Automation Engineer
    Intracom, Research & Development Division
    Development Programmes Department
    Athens, Greece

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