Professional Web Applications Themes

PLS HELP: ActiveX control / apartment threading error - ASP.NET General

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 ...

  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. #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-SPAMgo-intech.com> wrote in message
    news:OPbE7VZRDHA.2148TK2MSFTNGP11.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

  3. #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_usshotmail.com> wrote in message
    news:060101c3459f$eb15d8e0$a301280aphx.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

Similar Threads

  1. User Control and ActiveX control
    By xudeutsch in forum ASP.NET Building Controls
    Replies: 1
    Last Post: December 3rd, 02:49 PM
  2. Namespace for apartment threading modules ?
    By Dean Arnold in forum PERL Modules
    Replies: 0
    Last Post: August 17th, 09:10 PM
  3. Using MFC ActiveX control in ASP
    By Brett Robichaud in forum ASP Components
    Replies: 3
    Last Post: September 29th, 09:00 PM
  4. Threading model to 'Any Apartment'
    By vivek in forum ASP Components
    Replies: 1
    Last Post: August 15th, 05:45 PM
  5. ActiveX control on ASP.NET Web Form Runtime Error
    By ann in forum ASP.NET General
    Replies: 0
    Last Post: July 24th, 10:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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