本文介绍了设置FolderBrowserDialog1.SelectedPath时的VB.NET错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您知道为什么会这样吗? 如果(strCampaignFolder<> " )然后 当strCampaignFolder已经由FolderBrowserDialog1.SelectedPath设置的值已经在下面时,下一行可以正常工作. FolderBrowserDialog1.SelectedPath = strCampaignFolder 其他 '问题:当strCampaignFolder不存在值时,下一行会导致外部.NET代码'UnsafeNativeMethods'进入应用休眠状态. FolderBrowserDialog1.SelectedPath = " L:\ InternetMarketing \ AdWordsCampaigns \ LiveChat-Software" 结束 如果 如果 FolderBrowserDialog1.ShowDialog()= DialogResult.OK 然后 获取广告系列文件夹 strCampaignFolder = FolderBrowserDialog1.SelectedPath 结束 如果 您能建议一种解决方法吗? 解决方案 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? 解决方案 这篇关于设置FolderBrowserDialog1.SelectedPath时的VB.NET错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-31 20:16