title: Debugging error: "Object reference not set to an instance of an object"
body: <h2>Introduction (Warning: Bad English)</h2>
  
  <p>Hello everybody. I need some help with my program. </p>
  
  <p>So, basically my program is made for downloading one file and extracting it to known path, for example <code>C:\Users\ProfileName\Documents\Windward</code>. This path is suitable for most part of people. But for some people it's wrong path (Because file need's to be installed in <code>Documents\Windward</code> folder). So i decided to make changeable path. I thought I making everything right, but something gone wrong. And i thing something is frong with this: <code>Dim path As String = TextBox1.Text &amp; "\Localization.zip"</code>, but i don't know how to fix it.</p>
  
  <p>Please help me!</p>
  
  <h2>Error:</h2>
  
  <pre><code>    An unhandled exception of type System.InvalidOperationException occurred in AutoDownloadV2.exe
  
      Additional information: Error in form creating.  Exception.InnerException. Error: Object reference not set to an instance of an object.
  </code></pre>
  
  <h2>After Debug I recieve this:</h2>
  
  <pre><code>in AutoDownloadV2.My.MyProject.MyForms.Create__Instance__[T](T Instance) in :string 190
  
  in AutoDownloadV2.My.MyApplication.OnCreateMainForm() в B:\Projects\Progs\AutoDownloadV2\AutoDownloadV2\AutoDownloadV2\My Project\Application.Designer.vb:string 35
  
  in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
  
  in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
  
  in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
  
  in AutoDownloadV2.My.MyApplication.Main(String[] Args) in :string 81 The program '[5452] AutoDownloadV2.exe' has exited with code 0 (0x0).
  </code></pre>
  
  <h2>Here is my code (I have removed the useless part of code.)</h2>
  
  <pre><code>Public Class Form1
  
  Public WithEvents download As WebClient
  Dim path As String = TextBox1.Text &amp; "\Localization.zip"
  
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      TextBox1.Text = "C:\Users\" &amp; SystemInformation.UserName &amp; "\Documents\Windward"
      ProgressBar1.Value = 0
      CheckForIllegalCrossThreadCalls = False 
  End Sub
  
  Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      Try
          Try
              My.Computer.FileSystem.DeleteFile(path)
          Catch ex As Exception
          End Try
          download = New WebClient
          download.DownloadFileAsync(New Uri("http://http://exsite.example"), path)
      Catch ex As Exception
          MsgBox("Error! " &amp; ex.Message)
      End Try
  End Sub
  
  Private Sub download_DownloadProgressChanged(ByVal sender As System.Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles download.DownloadProgressChanged
      Try
          Label3.Text = "Downloaded : " &amp; e.BytesReceived / 1024 &amp; " kb / " &amp; e.TotalBytesToReceive / 1024 &amp; " kb  "
          Label4.Text = ProgressBar1.Value &amp; "%"
          ProgressBar1.Value = e.ProgressPercentage
      Catch ex As Exception
          MsgBox("Error! " &amp; ex.Message)
      End Try
      If e.BytesReceived = e.TotalBytesToReceive Then
          Unzip()
      End If
  End Sub
  
  Public Sub Unzip()
      Dim startPath As String = path
      Dim zipPath As String = path
      Dim extractPath As String = ("C:\Users\" + SystemInformation.UserName + "\Documents\Windward\")
      If My.Computer.FileSystem.FileExists(extractPath + "mods\translateMod\Localization.txt") Then
          My.Computer.FileSystem.DeleteFile(extractPath + "mods\translateMod\Localization.txt")
          Try
              My.Computer.FileSystem.DeleteFile(extractPath + "mods\translateMod\Version.txt")
          Catch e As Exception
          End Try
          ZipFile.ExtractToDirectory(zipPath, extractPath)
          My.Computer.FileSystem.DeleteFile(path)
      Else
          ZipFile.ExtractToDirectory(zipPath, extractPath)
          My.Computer.FileSystem.DeleteFile(path)
      End If
  End Sub
  End Class
  </code></pre>