.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Web browser using vb.net

Posted By:laptop charles       Posted Date: June 29, 2010    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com  

It is a simple web browser.
 

It contain tab with browser.
it can possible multiple tab available.
And also close a selected tab.
Then add a new tab.
And also contain google quick search and yahoo quick search.
And with gmail and yahoo mail .
With contain a web site "www.dotnetspark.com"
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Windows
Imports System.Windows.Forms
Imports System.Web





Public Class Charles_Webbrowser
    Dim a As Integer = 1


    Dim brow As New Forms.WebBrowser
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim brow As New Forms.WebBrowser
        brow.Name = "wb"
        brow.Dock = DockStyle.Fill

        AddHandler brow.DocumentCompleted, AddressOf brow_done
        TabControl1.TabPages.Add(a, " WebPage " & a)
        TabControl1.SelectTab(a - 1)
        TabControl1.SelectedTab.Controls.Add(brow)
        a = a + 1

    End Sub

    Private Sub NewTab_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTab.Click
        Dim brow As New Forms.WebBrowser
        brow.Name = "wb"
        brow.Dock = DockStyle.Fill
        AddHandler brow.DocumentCompleted, AddressOf brow_done


        TabControl1.TabPages.Add(a, " WebPage " & a)
        TabControl1.SelectTab(a - 1)
        TabControl1.SelectedTab.Controls.Add(brow)
        a = a + 1
    End Sub
    Private Sub brow_done(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
        TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).DocumentTitle
    End Sub

    Private Sub CloseTab_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTab.Click
        TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
        TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
        a = a - 1

    End Sub

    Private Sub go_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles go.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Navigate(com.Text)

        prograssbar.Step = DownloadProgressChangedEventArgs
        prograssbar.Value = 0
        Timer1.Enabled = True
        go.Enabled = False

    End Sub

    Private Sub Back_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Back.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).GoBack()
    End Sub

    Private Sub Forward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Forward.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).GoForward()
    End Sub

    Private Sub Stopm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Stopm.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Stop()
    End Sub

    Private Sub Home1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Home1.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).GoHome()
    End Sub

    Private Sub Refersh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Refersh.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Refresh()
    End Sub

    Private Sub appawebsite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles appawebsite.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Navigate("http://www.jeyabal.com/")
    End Sub

    Private Sub ChristianThrumanam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChristianThrumanam.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Navigate("http://www.christianthirumanam.com/")
    End Sub

    Private Sub Googlego_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Googlego.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Navigate("http://www.google.co.in/search?hl=en&source=hp&q=" & Googletext.Text & "&aq=f&aqi=&aql=&oq=&gs_rfai=")
    End Sub

    Private Sub yahoosearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles yahoosearch.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Navigate("http://in.search.yahoo.com/search?vc=&p=" & yahootext.Text & "&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-704")
    End Sub

    Private Sub gmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gmail.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Navigate("http://www.gmail.com/")
    End Sub

    Private Sub yahoomail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles yahoomail.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Navigate("http://www.yahoomail.com/")

    End Sub
    Private Sub dotnetspark_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles yahoomail.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), Forms.WebBrowser).Navigate("http://www.dotnetspark.com/")

    End Sub





End Class


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend