By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,928 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,928 IT Pros & Developers. It's quick & easy.

PLS HELP: ActiveX control / apartment threading error

P: n/a
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 thisVB.NET user control inside of an ASP.NET webform. When I run the webform Iget 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
.

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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]" <sr********@hotmail.com> wrote in message
news:06****************************@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
.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.