Make a button "Navigate" or..
Use GetAsyncKeyState..
If you use a button you can always do on the form_load:
Me.AcceptButton = NavigateButton
Hello!
Im trying to make my webbrowser navigate to the website in textbox1 when i press enter, but i cant figure out how to do so.
I have tried the following code:
But i get an error:Code:Private Sub TextBox1_OnEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged OnEnter.WebBrowser1.Navigate(TextBox1.Text) End Sub
Error 1 Overload resolution failed because no accessible 'OnEnter' accepts this number of arguments.
Can someone please help me to get it working?
Thanks!
Make a button "Navigate" or..
Use GetAsyncKeyState..
If you use a button you can always do on the form_load:
Me.AcceptButton = NavigateButton
Xizors (06-10-2011)
Code:Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.Enter Then WebBrowser1.Navigate(TextBox1.Text) End If End Sub
Xizors (06-11-2011)
GetAsyncKeyState would be pretty much useless in this example. GetAsyncKeyState is global, meaning even if you don't have your webbrowsers focused, it'll still execute.
Keydown is the best way of doing it in this case.
Thanks for the help
Please mark as Solved.