473,382 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

What is the difference

between STAThread and MTAThread?
Nov 16 '05 #1
6 1440
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM interop
is used.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"DAMAR" <DA***@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
between STAThread and MTAThread?

Nov 16 '05 #2
Bob Powell [MVP] wrote:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM interop
is used.


Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin
Nov 16 '05 #3
You should't remove the attribute for Windows forms based programs (note
that for VB.NET it's the default), simply because it's not because you don't
use COM that Windows Forms doesn't use it under the covers (think of OLE
drag/drop and ActiveX controls in the toolbox).
Your problem is not directly related to the STAThread attribute anyway.

Willy.
"Marcin Grzębski" <mg*******@taxussi.no.com.spam.pl> wrote in message
news:ct**********@atlantis.news.tpi.pl...
Bob Powell [MVP] wrote:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM
interop is used.


Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin

Nov 16 '05 #4
Marcin,

You are sure that it is not this known problem?
https://knowledgemap.nai.com/phpclie..._KnowledgeBase

Cor
Nov 16 '05 #5
Hi,

THANKS!
:-)
You're hit the 10!

McAfee VirusScan - source of all evil ;-)
[i hope in .NET only]

Cheers!
Marcin
Marcin,

You are sure that it is not this known problem?
https://knowledgemap.nai.com/phpclie..._KnowledgeBase

Cor

Nov 16 '05 #6
Hi Willy,

Thank you too!
Antivirus makes my trouble. But i'm so curios about
[STAThread] relation.

Cheers :-)
Marcin
You should't remove the attribute for Windows forms based programs (note
that for VB.NET it's the default), simply because it's not because you don't
use COM that Windows Forms doesn't use it under the covers (think of OLE
drag/drop and ActiveX controls in the toolbox).
Your problem is not directly related to the STAThread attribute anyway.

Willy.
"Marcin Grzębski" <mg*******@taxussi.no.com.spam.pl> wrote in message
news:ct**********@atlantis.news.tpi.pl...
Bob Powell [MVP] wrote:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM
interop is used.


Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin


Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
1
by: mike | last post by:
best regards: What is the difference between DOM Level 1 and DOM Level 2. Thank you. May god be with you.
5
by: radnus2004 | last post by:
Hi all, I am not clear what is the difference between signed and unsigned in C. Many say, unsigned means only +ve values and 0. Can I use unsigned int i = -3? What happens internally ? What...
10
by: tinesan | last post by:
Hello fellow C programmers, I'm just learning to program with C, and I'm wondering what the difference between signed and unsigned char is. To me there seems to be no difference, and the...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
12
by: Nathan Sokalski | last post by:
What is the difference between the Page_Init and Page_Load events? When I was debugging my code, they both seemed to get triggered on every postback. I am assuming that there is some difference,...
3
by: Anoj Kumar | last post by:
Hi All , can anyone tell me what is the difference between the following declaration and how it affects application performance. 1. Dim cn As ADODB.Connection Set cn = New ADODB.Connection
6
by: Mark Kamoski | last post by:
Hi Everyone-- Please help. What is the difference between a Field and a Property? Here is the context. In the VS.NET 2002 documentation, in the "String Members" section, we have the...
5
by: kai | last post by:
Hi, In ASP.NET , what is the difference between OnClick and Click events for a button? Because we have button click event, it can trigger events, why we still need OnClick? Please help. ...
49
by: Zach | last post by:
After having taken a looong break from VB (last used 6.0), I started getting back into programming again, this time with VS 2005. I began reading up on VB.NET from various sources (books,...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
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...
0
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,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.