Net-informations.com
SiteMap  | About    

How to VB.Net Web Browser

The Web Browser control in VB.NET allows you to host Web pages and other web browser enabled documents in your Windows Forms applications. You can add browser control in your VB.Net projects and it displays the web pages like normal commercial web browsers . You can use the Browser control to add your existing Web based controls to your Windows Forms client applications.

web-browser

The WebBrowser control has several properties, methods, and events related to navigation. The following VB.Net program displays a web page in browser window and also you can retrieve the source code of the same web page with another button click.




Imports System.IO
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.Navigate(TextBox1.Text)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim source As [String] = ("viewsource.txt")
        Dim writer As StreamWriter = File.CreateText(source)
        writer.Write(WebBrowser1.DocumentText)
        writer.Close()
        Process.Start("notepad.exe", source)
    End Sub
End Class




net-informations.com (C) 2016    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.