"AgentM" <AgentM@xxxxxx> wrote in message
> Hi, I am trying to call the "FolderBrowserDialog" from a UI which is shown
> a C# Cmdlet.
> I am getting the error
> Current thread must be set to single thread apartment (STA) mode before
> 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