In visual basic the simplest application ever could be created is a web browser. Visual basic already contain a web browser control within the toolbox, after adding it we could easily play around with the many web browser functions like navigate (to navigate to a particular website), refresh, etc. In this tutorial we will see how we can create a simple web browser in visual basic.
Also Read: How to Create a Keylogger in VB.Net?
How to Create a Web Browser in Visual Basic
1. First of all create a new windows form application in visual basic.
2. Now add 4 buttons and change their text as given below.
Button1 – << (To move backword)
Button2 – >> (To move forward)
Button3 – Refresh
Button4 – Go
3. Add a textbox and align them in the manner shown below.
4. Now double click the form to switch to code view and paste the code given below.
Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click WebBrowser1.GoBack() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click WebBrowser1.GoForward() End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click WebBrowser1.Refresh() End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click WebBrowser1.Navigate(TextBox1.Text) End Sub Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown If e.KeyData = Keys.Enter Then Button4.PerformClick() End If End Sub Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged End Sub End Class
5. You have done!! Hit Debug and browse some of your favorite sites with your own fully functional web browser.
If you liked this tutorial then please take your few seconds to share it!
THIS IS NICE
I’m using Visual Studio 2022.
There’s no web browser control in the tool box.
Any suggestions?
I’m wondering about the WebBrowser control too. I’m using Visual Studio 2022 and although it says I have the WebBrowser control when I try to add it to the toolbar, it never actually appears in the toolbar.