I face this error when I'm trying to browse files using OpenFileDialog1 in vb.net
Attempted to read or write protected memory. This is often an indication that other memory is corrupt
I'm using this code:
Try
OpenFileDialog1.Filter = "(*.jpg)|*.jpg"
OpenFileDialog1.InitialDirectory = Nothing
OpenFileDialog1.FileName = ""
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName > "" Then
TextBox8.Text = OpenFileDialog1.FileName
PictureBox1.Image = Image.FromFile(TextBox8.Text)
End If
Catch ex As Exception
MsgBox(ex.Message)
Exit Sub
End Try
Everything works fine on my machine, but this error apears when run the app on the client machine!
Any ideas please?
I had same issue, Just clean all solution project then rebuild.