Possible Duplicate:
Attempted to read or write protected memory. When I call showDialog method of openfileDialog
Not sure why. It was originally working just fine, then I made some changes to the code that should have had no effect on this.
The changes I made where to just change some properties of a checkbox when the file is selected:
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs)
attachmentLabel.Text = OpenFileDialog1.FileName.ToString()
attachmentCheckBox.Visible = True
attachmentCheckBox.Checked = True
End Sub
Here's the event handler that calls OpenFileDialog1.ShowDialog()
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
OpenFileDialog1.Title = "Please Select a File"
OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.ShowDialog()
End Sub
Any help would be appreciated. When the exception occurs, the values for e and sender say "unable to evaluate expression".