i have an exception nullreference was unhandled.herewith i have enclosed the code and what message i haved while executing.

Imports System.IO
Imports System.Net
Imports System.Text

Public Class Form1

Public Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submitButton.Click
Dim Str As System.IO.Stream
Dim srRead As System.IO.StreamReader

Dim nullObject As System.Object = 0
Dim str1 As String = "http://" & ipaddressTextBox.Text

Dim nullObjStr As System.Object = str1
Cursor.Current = Cursors.WaitCursor
WebBrowser1.Navigate(str1) ', nullObject, nullObjStr, nullObjStr, nullObjStr)
Cursor.Current = Cursors.Default


' make a Web request
Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(str1)
Dim resp As System.Net.WebResponse = req.GetResponse
Str = resp.GetResponseStream
srRead = New System.IO.StreamReader(str1)
' read all the text

TextBox1.Text = srRead.ReadToEnd

Catch ex As Exception
TextBox1.Text = "Unable to download content"
' Close Stream and StreamReader when done
End Try

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim store As String

store = TextBox1.Text
TextBox2.Text = store
'TextBox1.Text = ""

End Sub
End Class

Exception occured
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
at WindowsApplication1.Form1.submitButton_Click(Object sender, EventArgs e) in C:\Documents and Settings\sreeram\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.vb:line 42
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


Wrap up source code with BB code tags.

Str = resp.GetResponseStream
srRead = New System.IO.StreamReader(Str)

Wrap up source code with BB code tags.

Str = resp.GetResponseStream
srRead = New System.IO.StreamReader(Str)

thank you yar its working but if i changed urladdress html soucre displayed in the textbox it is displaying the first opened page source.for that what i have change the code.


What do you want to see?

What do you want to see?

i want see the html source of the page i have opened

yeah i am also using this code ,but i that while i executing the code,once we enter the address(e.g www.daniweb.com) and after that we are chaging the address(e.g www.daniweb.com/forum).now this time we can't get the html source of the new page we have opened.

sorry ,there is a change.The page we have opened (e.g www.daniweb.com) and after we are login in to it then after typing the address in the address bar their is a change in the url. Here we copy the address and we are giving that now then the html source what we have before logined.