Tuesday, 17 January 2012

vb.net code for my own web browser


How to make my own browser in vb.net code?
Steps to create a random number generator
Step1:  File new project ->windows forms application -> rename my browser
Step2:  Drag and drop the five buttons, one textboxes, and web browser from tool box and click web browser properties. Change the anchor options

Step3:  Rename button1 as go, button2 as stop, button3 as back, button4 as forward, button5 as exit
Step4: Double click the go button 
Write the code:
      Private SubButton1_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) HandlesButton1.Click
        WebBrowser1.Navigate(TextBox1.Text)
        If TextBox1.Text = ""Then
            MessageBox.Show("enter the  url...! ")
        End If
    End Sub
Private Sub Button2_Click(ByVal sender AsSystem.Object, ByVale As System.EventArgs) _ Handles Button2.Click
        WebBrowser1.Stop()
    End Sub
    Private SubButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _  HandlesButton3.Click
        Close()
    End Sub
    Private SubButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ HandlesButton4.Click
        WebBrowser1.GoForward()
    End Sub
    Private SubButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ HandlesButton5.Click
        WebBrowser1.GoBack()
    End Sub
    Private SubWebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As _ System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    End Sub
    Private SubButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ HandlesButton6.Click
        Close()

    End Sub
 Step5: Run the application