I am working on a web browser, when you enter the URL into the text box, you cannot press enter and it work, you have to click the go button. How would I make the enter button get the browser to navigate?
Printable View
I am working on a web browser, when you enter the URL into the text box, you cannot press enter and it work, you have to click the go button. How would I make the enter button get the browser to navigate?
In the TextBox's KeyDown event you can check for the enter key and fire away!
Edit: Do'h, accidently said to use TextChange. Fixed (stole Atheist's suggestion).
Handle the TextBox' KeyDown event and do this:
VB.Net Code:
If e.KeyCode = Keys.Enter Then WebBrowser1.Navigate(TextBox1.Text) End If
Or you can even set the form's Accept Button property to the Go button, so every time you press Enter, the Go buton will receive a click.
Can that piece of code just go anywhere?Quote:
Originally Posted by Atheist
No, it was intended for the TextBox' KeyDown event-handler.Quote:
Originally Posted by hah3303
Okay, how do I get to that area?
Nevermind, I found it.
Edit: Okay, great! Wow, I have learned a lot from this forum :D .