Hey everyone, I am modifying code upgraded from VB 6 to 2005. I need to run
the 2005 code in the MTA mode so I set a sub main procedure in my module
which runs first when the program starts:
Public theApplicationForm As New Form1
<MTAThread()> Public Sub main()
Application.Run(theApplicationForm)
End Sub
However, when this launches the Form1, I receive the following runtime error:
{"ActiveX control '6262d3a0-531b-11cf-91f6-c2863c385e30' cannot be
instantiated because the current thread is not in a single-threaded
apartment."}
I don't know how to proceed from here. I realize that the ActiveX component
is something old VB6 code still being used..I believe it is an MSFlexGrid.
How do I run my program as multithreaded successfully? MANY THANKS!! 5 5680
"Yeti" <Ye**@discussions.microsoft.com> schrieb Hey everyone, I am modifying code upgraded from VB 6 to 2005. I need to run the 2005 code in the MTA mode so I set a sub main procedure in my module which runs first when the program starts:
Public theApplicationForm As New Form1
<MTAThread()> Public Sub main() Application.Run(theApplicationForm) End Sub
However, when this launches the Form1, I receive the following runtime error: {"ActiveX control '6262d3a0-531b-11cf-91f6-c2863c385e30' cannot be instantiated because the current thread is not in a single-threaded apartment."}
I don't know how to proceed from here. I realize that the ActiveX component is something old VB6 code still being used..I believe it is an MSFlexGrid. How do I run my program as multithreaded successfully? MANY THANKS!!
If you use the ActiveX control, you must use the STAThread (or no)
attribute.
Why do you need MTAThread? You can create threads without this attribute.
Armin
"Armin Zingler" <az*******@freenet.de> schrieb "Yeti" <Ye**@discussions.microsoft.com> schrieb Hey everyone, I am modifying code upgraded from VB 6 to 2005. I need to run the 2005 code in the MTA mode so I set a sub main procedure in my module which runs first when the program starts:
Public theApplicationForm As New Form1
<MTAThread()> Public Sub main() Application.Run(theApplicationForm) End Sub
However, when this launches the Form1, I receive the following runtime error: {"ActiveX control '6262d3a0-531b-11cf-91f6-c2863c385e30' cannot be instantiated because the current thread is not in a single-threaded apartment."}
I don't know how to proceed from here. I realize that the ActiveX component is something old VB6 code still being used..I believe it is an MSFlexGrid. How do I run my program as multithreaded successfully? MANY THANKS!!
If you use the ActiveX control, you must use the STAThread (or no) attribute.
Skip the "(or no)" words. Default is MTAThread for the main procedure of the
startup thread.
Why do you need MTAThread? You can create threads without this attribute.
Armin
Thanks for getting back to me Armin. I need to use the MTAThread so that I
can subscribe to an OPC server. Any workarounds or should I just delete all
the ActiveX's?- Owen
"Armin Zingler" wrote: "Armin Zingler" <az*******@freenet.de> schrieb "Yeti" <Ye**@discussions.microsoft.com> schrieb Hey everyone, I am modifying code upgraded from VB 6 to 2005. I need to run the 2005 code in the MTA mode so I set a sub main procedure in my module which runs first when the program starts:
Public theApplicationForm As New Form1
<MTAThread()> Public Sub main() Application.Run(theApplicationForm) End Sub
However, when this launches the Form1, I receive the following runtime error: {"ActiveX control '6262d3a0-531b-11cf-91f6-c2863c385e30' cannot be instantiated because the current thread is not in a single-threaded apartment."}
I don't know how to proceed from here. I realize that the ActiveX component is something old VB6 code still being used..I believe it is an MSFlexGrid. How do I run my program as multithreaded successfully? MANY THANKS!!
If you use the ActiveX control, you must use the STAThread (or no) attribute.
Skip the "(or no)" words. Default is MTAThread for the main procedure of the startup thread.
Why do you need MTAThread? You can create threads without this attribute.
Armin
"Yeti" <Ye**@discussions.microsoft.com> schrieb Thanks for getting back to me Armin. I need to use the MTAThread so that I can subscribe to an OPC server. Any workarounds or should I just delete all the ActiveX's?- Owen
Why not start another thread that communicates with the OPC server? If you
do it, be aware of what the docu says: You must set the ApartmentState
property of the other thread before you start it.
Armin
Sounds good...I'm looking into it..thanks
"Armin Zingler" wrote: "Yeti" <Ye**@discussions.microsoft.com> schrieb Thanks for getting back to me Armin. I need to use the MTAThread so that I can subscribe to an OPC server. Any workarounds or should I just delete all the ActiveX's?- Owen
Why not start another thread that communicates with the OPC server? If you do it, be aware of what the docu says: You must set the ApartmentState property of the other thread before you start it.
Armin
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mark Sisson |
last post by:
Hey all.
I've got a legacy COM dll that I'd like to use in my multithreaded C#
app. Problem though is when I create several instances of the interop
object and start them on their own threads...
|
by: Ed |
last post by:
Here's my situation, I am moving some of my apps over from native C++
(primarily Win32 and MFC).
One of these apps uses some COM objects in worker threads running in the
background where it...
|
by: Robert Zurer |
last post by:
Can anyone suggest the best book or part of a book on this subject. I'm
looking for an in-depth treatment with examples in C#
TIA
Robert Zurer
robert@zurer.com
|
by: Cybertof |
last post by:
Hello,
Is there a good way to call a big time-consumming function from an
ActiveX DLL (interoped) through a thread without blocking the main UI ?
Here are the details :
I have a class...
|
by: sarge |
last post by:
I would like to know how to perform simple multithreading.
I had created a simple form to test out if I was multithreading
properly, but got buggy results. Sometime the whole thig would lock
up...
|
by: Rich |
last post by:
Hello,
I have set up a multithreading routine in a Test VB.net
proj, and it appears to be working OK in debug mode and I
am not using synchronization. Multithreading is a new
thing for me, and...
|
by: sandy82 |
last post by:
Whats actuallly multithreading is ... and how threading and
multithreading differ .
Can any1 guide how multithreading is used on the Web .. i mean a
practical scenario in which u use...
|
by: boo73uk |
last post by:
Hi All,
I'm going to rewrite a VB6 app to VB.net and I need some pointers.
Basically this app spawns simultaneous,multiple, independant
ActiveX.exe 'workers' which query a SQL Server database and...
|
by: Ray |
last post by:
Hello,
Greetings! I'm looking for a solid C++ multithreading book. Can you
recommend one? I don't think I've seen a multithreading C++ book that
everybody thinks is good (like Effective C++ or...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |