0

hi! ok i have a search engine. it works fine. only thing is that when i write something in the textbos i must click the button 'Search' with my mouse for it to start searching. what i want to do is write something to the textbox and hit the 'Enter' key and then start searching.

i searched the forum and i only found this


Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
If e.KeyCode = Keys.Return Then
keyPressed()
End If
End Sub


Sub keyPressed()
MsgBox("Enter key Pressed.")
End Sub

but i didn't undertand it much... :S

any help would be welcome!! thanks!!!

Edited by drdream100: n/a

3
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by Netcode
0

ok i made it work with this:

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            MsgBox("Help!!!")
        End If
    End Sub

now i have another question. i have this for example :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim st As String
st = TextBox1.Text
End Sub

and i want to use the 'st' on the first code above without using dim again. is there any way??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.