Windows Vista Forums

STATThread error

  1. #1


    AgentM Guest

    STATThread error

    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.

      My System SpecsSystem Spec

  2. #2


    Jon Guest

    Re: STATThread error

    "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




      My System SpecsSystem Spec

STATThread error

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when sending e-mail (error in outbox) Error ID: 0x80191002 Stefano Live Mail 1 10 Mar 2010
"Error 1935. An error ocurred during the installation of assembly 'Microsoft.VC80.AL srom66 Software 2 03 Jan 2010
Help with windows vista mail, Socket Error: 10053, Error Number: 0x800CCC0F ASM Vista mail 5 18 Feb 2009
Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F ThatsIT.net.au Vista mail 1 09 Mar 2008
windows live mail 2008 (Build 12.0.1606) error report error gbp007 Windows Live 13 24 Jan 2008