Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FolderBrowserDialog

Status
Not open for further replies.

sacsac

Programmer
Joined
Dec 10, 2000
Messages
182
Location
GB
I have discovered a problem with the FolderBrowserDialog. If instead of selecting a folder with a left-click the mouse right-click is used, then a trappable error #99 occurs ("External component has thrown an exception"). Any further interaction with the dialog then throws a system error "Attempted to read or write protected memory", followed by application crash. Has anyone else encountered this, and if so what solution was used? Here is a sample of the code I am using:

Using fd As New FolderBrowserDialog

With fd

.RootFolder = Environment.SpecialFolder.Desktop
.SelectedPath = "C:\"
Try
If .ShowDialog Windows.Forms.DialogResult.OK Then
MessageBox.Show(.SelectedPath & " selected")
''do something
''
''''''''''''''
Else
MessageBox.Show("No Folder selected")
End If
Catch ex As Exception
MessageBox.Show(Err.Number & vbCrLf & ex.Message)

End Try

End With

End Using
 

I copied your code into a test project in VS 2008 and I could not replicate the error you are getting. I compiled the code against the 3.5, 3.0 and 2.0 versions of the framework, and I got no errors. I right-clicked items, created new folders, etc.

What version of Visual Studio and the .NET Framework are you using?


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Hi jebenson

I'm using VS2010 with .NET4
 

Unfortunately, I do not have access to VS 2010.

Try changing the target framework to 3.5 or lower, and see if the error still occurs.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Whatever the target .net framework the problem persists. However, I now believe that this is probably a problem with my development PC, and nothing to do with the programming! I note that the issue does not exist when the compiled application is run on other machines. Also, I encounter a similar problem with my PC when right-clicking a folder in Windows Explorer. I have no idea what is causing this - maybe I'll discover it in the fulness of time. Thanks for your help anyway jebenson!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top