Click here to Skip to main content
15,886,919 members
Articles / Programming Languages / Visual Basic

Working with the Web Browser Control in Visual Studio 2005 - IE7Clone.

Rate me:
Please Sign up or sign in to vote.
4.89/5 (65 votes)
14 Jan 20076 min read 587.6K   12.1K   150  
Example application working with the VS2005 Web browser control
'///////////////////////////////////////////
'This form just shows a little bit of grabbing
'some info from the loaded document and 
'displaying it.
'simular routines could be use to implement
'additional security such as a phishing filter
'etc.
'///////////////////////////////////////////
Public Class frmSecInfo

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub frmSecInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim oelement As HtmlElement
        For Each oelement In AppManager.CurrentBrowser.Document.Links
            ListBox1.Items.Add(oelement.GetAttribute("HREF"))
        Next

        Dim str As String = AppManager.CurrentBrowser.Document.Cookie.ToString
        txtCookie.Text = str
    End Sub

    Private Sub lbCookies_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lbCookies.LinkClicked
        Dim ofrm As New frmBrowser
        AppManager.AddTab(ofrm, "http://www.microsoft.com/info/cookies.mspx")
        Me.Close()
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
I have played various roles in IT since around 1993 when I began writing commercial web pages. I then moved to mainly coding in Visual Basic around 1995, making point of sale and kiosk systems, more recently moving to e-commerce and crm applications. Since the release of .net I have been mainly working in .net focusing in vb.net although I have done several projects in c#. I have worked for various companies and have held the position of lead developer at several, recently (2005) leading the e-commerce team at a national retailer to a successful e-commerce implementation. I currently hold comptia a+, network plus, mcp, mcsa, mcse (server system 2003) and mcsd certifications. I enjoy sharing what I have learned as well as embracing new technologies as they are released.

Comments and Discussions