FAQ: How do I create my own Web Browser?
ล็อกแล้ว
-
Saturday, April 11, 2009 11:27 AM
How do I create my own Web Browser?
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
All Replies
-
Saturday, April 11, 2009 11:28 AM
We usually create our own web browsers using the existing WebBrowser control which provides some basic navigation functions.
For example: Create a simple web browser.
Drap&drop a TextBox control used as the address bar, drap&drop a ToolStrip control add some ToolStripButtons used as Go, Back, Forward, Stop, Refresh, etc.
Public Class Form1 ' Go button Private Sub btnGo_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnGo.Click WebBrowser1.Navigate(txtURL.Text) End Sub ' In Address bar, press Enter to go Private Sub txtURL_KeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtURL.KeyDown If e.KeyData = Keys.Enter Then btnGo.PerformClick() e.SuppressKeyPress = True End If End Sub ' Back button Private Sub tsBtnBack_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles tsBtnBack.Click If WebBrowser1.CanGoBack Then WebBrowser1.GoBack() End If End Sub ' Forward button Private Sub tsBtnForward_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles tsBtnForward.Click If WebBrowser1.CanGoForward Then WebBrowser1.GoForward() End If End Sub ' Stop button Private Sub tsBtnStop_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles tsBtnStop.Click WebBrowser1.Stop() End Sub ' Refresh button Private Sub tsRefreshNormal_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles tsRefreshNormal.Click WebBrowser1.Refresh() End Sub ' Home button Private Sub tsBtnHome_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles tsBtnHome.Click WebBrowser1.GoHome() End Sub ' Search button Private Sub tsBtnSearch_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles tsBtnSearch.Click WebBrowser1.GoSearch() End Sub End Class
Please visit these links for some detailed ideas related to this topic:
http://social.msdn.microsoft.com/forums/en-US/vbide/thread/ec4b4255-9a87-4649-b297-cbcd83cbef86/
For more FAQ about Visual Basic .NET General, please see Visual Basic .NET General FAQ
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer by Xiaoyun Li – MSFT Saturday, April 11, 2009 11:31 AM

