this is going to be a simple tutorial , there are two ways to get the source code of a website in vb.net you know what are they so lets start making them
Web Browser
1.open your visual basic 2008/2010
4.add a richtextbox and a textbox
Web Browser
1.open your visual basic 2008/2010
2.create a new project and name it whatever
3.add a webbrowser from toolbox and place it some where else
4.add a richtextbox and a textbox
5.add a button and change the button text property to get source code
6.double click your form and erase everything add this code
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 WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted RichTextBox1.Text = WebBrowser1.DocumentText End Sub End Class
7.debug
preview -
preview -
HttpWebRequest
httpwebrequest is fast and more efficient than webbrowser
1.open your visual basic 2008/2010
2.create a new project and name it whatever you want
3.add a richtextbox and a textbox
4.add a button and name it get source code
5.double click your form and erase everything and add these code
Imports System.Net Imports System.IO Public Class Form1 'Author : Mohamed Shimran 'Blog : http://www.ultimateprogrammingtutorials.blogspot.com Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(TextBox1.Text) Dim response As System.Net.HttpWebResponse = request.GetResponse() Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream()) Dim sourcecode As String = sr.ReadToEnd() RichTextBox1.Text = sourcecode End Sub End Class6.debug
preview -
Post a Comment
Note: Only a member of this blog may post a comment.