问题描述
大家好,
我想打开SaveFileDialog Box。但我得到错误:
当前线程必须设置为单线程单元(STA)模式才能进行OLE调用。确保您的Main函数标记了STAThreadAttribute。只有在调试器附加到进程时才会引发此异常。
我正在使用WPF和VS2010开发项目。使用WPF开发UI。在管理器层,我尝试打开SaveFileDialog Box。
我尝试设置[STAThreadAttribute]和[STAThread]属性,但我无法实现,任何人都可以帮助我。
Hi to all,
I want to open SaveFileDialog Box. But am getting the Error :
Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process.
I am Developing the project using WPF and VS2010. Developed UI Using WPF. At the manager Layer I tried to Open SaveFileDialog Box.
I tried To set the [STAThreadAttribute] and [STAThread] attributes but I was not able to implement that can any one help me please.
这篇关于请将STAThreadAttribute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!