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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bug when setting FolderBrowserDialog1.SelectedPath in code

Status
Not open for further replies.

AbacusData

Technical User
Mar 2, 2010
1
GB
Do you know why this happens?

If (strCampaignFolder <> "") Then
'Next line works fine when strCampaignFolder already has a value set by FolderBrowserDialog1.SelectedPath further below.
FolderBrowserDialog1.SelectedPath = strCampaignFolder
Else 'PROBLEM: Next line causes the external .NET code 'UnsafeNativeMethods' to put the app to sleep when strCampaignFolder has no existing value!
FolderBrowserDialog1.SelectedPath = "L:\InternetMarketing\AdWordsCampaigns\LiveChat-Software"
End If
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
'Get Campaign folder
strCampaignFolder = FolderBrowserDialog1.SelectedPath
End If

Can you suggest a workaround, please?

 
I did a search on "UnsafeNativeMethods FolderBrowserDialog" (without the quotes) and found that this is an old bug in the FolderBrowserDialog on 64-bit systems. There is a fix for it:


Not sure if this will work for you or not.



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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top