"AgentM" <AgentM@xxxxxx> wrote in message
news:1B1661DA-BD8E-468F-B5AC-0D9E3D19C9BC@xxxxxx
> Hi, I am trying to call the "FolderBrowserDialog" from a UI which is shown
> by
> a C# Cmdlet.
> I 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.
>
> How do I get rid of this error, I have tried using STAthread before the
> functioncall but it is not working.
> Any help appreciated.
The code in this blog entry may help .....
Thread.ApartmentState and PowerShell Execution Thread
http://blogs.msdn.com/powershell/arc...on-thread.aspx
--
Jon