title: Allow user to upload picture in Visual Basic
body: <p>I am very new to Visual Basic so please be gentle. :P</p>
  
  <p>I am creating a small application, for basic learning purposes, which will allow a user of the application to update a profile of sorts. This includes, uploading a profile picture, which is then stored in /bin/Debug/Resource and then displayed on their profile in a PictureBox.</p>
  
  <p>I am using the following code, which seems to do just that. However, when I close the application and run it again, the image is not displayed on either PictureBox but is still stored in the designated folder.</p>
  
  <pre><code>    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  
      If (Not System.IO.Directory.Exists("Resource")) Then
          System.IO.Directory.CreateDirectory("Resource")
      End If
  
  
      Dim OpenFileDialog1 As New OpenFileDialog
      With OpenFileDialog1
          .CheckFileExists = True
          .ShowReadOnly = False
          .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
          .FilterIndex = 2
  
          '
          If .ShowDialog = DialogResult.OK Then
              Dim FName() As String = OpenFileDialog1.FileName.Split("\\")
              System.IO.File.Copy(OpenFileDialog1.FileName, "Resource\\" + FName(FName.Length - 1))
              PictureBox1.Image = Image.FromFile(.FileName)
              Profile.PictureBox1.Image = Image.FromFile(.FileName)
          End If
      End With
  End Sub        
  </code></pre>
  
  <p>Any help that you can provide is greatly appreciated.</p>
  
  <p>Thank you.</p>