PLS HELP: ActiveX control / apartment threading error

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default PLS HELP: ActiveX control / apartment threading error

    Hi,

    If you want to use the activex controls in your asp.net
    page, you ahev to use the single aprtment thread model.
    For that please add the "aspcompat=true" attribute the
    page directive.

    Let me know the result.

    Regards
    Sreejumon
    DOTNET makes IT happen
    >-----Original Message-----
    >I am using an ActiveX control in a VB.NET user control.
    I'm using this
    >VB.NET user control inside of an ASP.NET webform. When I
    run the webform I
    >get this error:
    >Could not instantiate ActiveX control 'd940e4d2-6079-11ce-
    88cb-0020af6845f6'
    >because the current thread is not in a single-threaded
    apartment.
    >
    >In my VB.NET usercontrol I put this (after researching on
    the internet):
    ><STAThread()> Public Sub Main()
    > System.Threading.Thread.CurrentThread.ApartmentSta te =
    >Threading.ApartmentState.STA
    >End Sub
    >
    >Still get the same error. I know NOTHING about COM.
    >
    >Any ideas?
    >
    >Thanks,
    >Robert
    >
    >
    >.
    >
    Sreejumon [MVP] Guest

  2. Similar Questions and Discussions

    1. User Control and ActiveX control
      Now I am hosting a user control(an assembly in .dll) in IE. I want to know the difference between this kind of control and ActiveX control. thank...
    2. Namespace for apartment threading modules ?
      Looking for namespace advice... After building a specialized set of classes to support apartment threading of DBI...
    3. Using MFC ActiveX control in ASP
      I'm using VS.Net 2003 to create a very simple ActiveX control in MFC. The control has no ui and just a few properties and methods. What do I...
    4. Threading model to 'Any Apartment'
      Hey guys, i am relatively new to this COM+ thing, i am trying to figure out where do i set the threading model for my application as 'any...
    5. ActiveX control on ASP.NET Web Form Runtime Error
      Hi, I am trying to add an ActiveX control on my ASP.NET web form (the language for code behind is C#). I have some client-side vbscript to...
  3. #2

    Default Re: PLS HELP: ActiveX control / apartment threading error

    try manually re-registering the component again.
    this seems to be a registration problem before being a thread problem unless
    you are doing some complex stuff

    "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
    news:OPbE7VZRDHA.2148@TK2MSFTNGP11.phx.gbl...
    > I am using an ActiveX control in a VB.NET user control. I'm using this
    > VB.NET user control inside of an ASP.NET webform. When I run the webform
    I
    > get this error:
    > Could not instantiate ActiveX control
    'd940e4d2-6079-11ce-88cb-0020af6845f6'
    > because the current thread is not in a single-threaded apartment.
    >
    > In my VB.NET usercontrol I put this (after researching on the internet):
    > <STAThread()> Public Sub Main()
    > System.Threading.Thread.CurrentThread.ApartmentSta te =
    > Threading.ApartmentState.STA
    > End Sub
    >
    > Still get the same error. I know NOTHING about COM.
    >
    > Any ideas?
    >
    > Thanks,
    > Robert
    >
    >

    Alvin Bruney Guest

  4. #3

    Default Re: PLS HELP: ActiveX control / apartment threading error

    Thanks for your response.

    The good news is that I don't get that error anymore after adding that
    directive to my aspx page. The bad news is that my user control (created in
    VB.NET & contains the non-managed ActiveX control) doesn't show up on the
    page. In fact, at design time it shows up at the bottom of the webform, I
    guess because I dont have a "custom designer" or something.

    Any ideas why this control doesn't show up?

    "Sreejumon [MVP]" <sreeju_uss@hotmail.com> wrote in message
    news:060101c3459f$eb15d8e0$a301280a@phx.gbl...
    > Hi,
    >
    > If you want to use the activex controls in your asp.net
    > page, you ahev to use the single aprtment thread model.
    > For that please add the "aspcompat=true" attribute the
    > page directive.
    >
    > Let me know the result.
    >
    > Regards
    > Sreejumon
    > DOTNET makes IT happen
    >
    > >-----Original Message-----
    > >I am using an ActiveX control in a VB.NET user control.
    > I'm using this
    > >VB.NET user control inside of an ASP.NET webform. When I
    > run the webform I
    > >get this error:
    > >Could not instantiate ActiveX control 'd940e4d2-6079-11ce-
    > 88cb-0020af6845f6'
    > >because the current thread is not in a single-threaded
    > apartment.
    > >
    > >In my VB.NET usercontrol I put this (after researching on
    > the internet):
    > ><STAThread()> Public Sub Main()
    > > System.Threading.Thread.CurrentThread.ApartmentSta te =
    > >Threading.ApartmentState.STA
    > >End Sub
    > >
    > >Still get the same error. I know NOTHING about COM.
    > >
    > >Any ideas?
    > >
    > >Thanks,
    > >Robert
    > >
    > >
    > >.
    > >

    VB Programmer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139