title: save image in vb.net and it gives me this error
body: <p>I wrote this code and i get this error "Object reference not set to an instance of an object."</p>
  
  <pre><code>Private Sub SAVEASToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SAVEASToolStripMenuItem.Click
      Dim FileToSaveAs As String = System.IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.Temp, SaveFileDialog1.FileName)
      REM PictureBox1.Image.Save(FileToSaveAs, System.Drawing.Imaging.ImageFormat.Jpeg)
      PictureBox1.Image.Save(FileToSaveAs, System.Drawing.Imaging.ImageFormat.Jpeg)
  End Sub
  </code></pre>