Results 1 to 3 of 3

Keypress Textbox

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142

    Keypress Textbox

    Hi all,

    I have a userform with a cmdButton, lstBox, and txtBox - the userform acts as a search tool for part numbers;

    I am trying to make the form more usable, so when I press enter whilst in the txtBox it will call a search function - I have tried various methods but everytime I press 'enter' it moves focus to the cmdButton and doesn't recognise the KeyPress ascii of 'enter'.

    I have successfully got it working on my listbox, see code below;

    Private Sub lstResult_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
        
        If KeyAscii = 13 Then
            If lstResult.Value <> "" And lstResult.Value <> "No Match Found" Then
                frmMain.cbxPartNumber.Value = lstResult.Text
                frmMain.txtBatchno.SetFocus
                Unload Me
            End If
        End If
        
    End Sub
    Any ideas or suggestions?

    Thanks
    Last edited by gti_jobert; 03-09-2006 at 06:18 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1