Hi! I'm very new to Visual Basic Express 2008 and I am trying to get a basic knowledge of the program so I took the tutorial that shows you how to make a basic webbrowser. Well I took it a little farther and added buttons like go forward/back refresh ect..
The problem I am having is this: When im typing in a web address and press the return key I want that to be the same as pressing the go button... Here is the code I have and it doesn't say anything is wrong it just doesn't work.
Here is my entire code incase this helps
I've read stuff about "focus" but I'm not sure how to use that or if I even need to.
Please I have been having a LOT of trouble with this so any help will be awesome!
The problem I am having is this: When im typing in a web address and press the return key I want that to be the same as pressing the go button... Here is the code I have and it doesn't say anything is wrong it just doesn't work.
Code:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As Integer) If KeyAscii = 13 Then WebBrowser1.Navigate(TextBox1.Text) End Sub
Code:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click WebBrowser1.Navigate(TextBox1.Text) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click WebBrowser1.Refresh() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click WebBrowser1.GoForward() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click WebBrowser1.GoBack() End Sub Private Sub TextBox1_KeyPress(ByVal KeyAscii As Integer) If KeyAscii = 13 Then WebBrowser1.Navigate(TextBox1.Text) End Sub End Class
Please I have been having a LOT of trouble with this so any help will be awesome!
Comment