Click here to Skip to main content
15,918,007 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Captain See Sharp6-Jan-07 17:05
Captain See Sharp6-Jan-07 17:05 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Luc Pattyn6-Jan-07 18:25
sitebuilderLuc Pattyn6-Jan-07 18:25 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era887-Jan-07 7:07
new_era887-Jan-07 7:07 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Captain See Sharp7-Jan-07 7:29
Captain See Sharp7-Jan-07 7:29 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era887-Jan-07 8:16
new_era887-Jan-07 8:16 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Captain See Sharp7-Jan-07 8:25
Captain See Sharp7-Jan-07 8:25 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era887-Jan-07 8:51
new_era887-Jan-07 8:51 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
WillemM7-Jan-07 7:34
WillemM7-Jan-07 7:34 
You can create a new thread and let it sleep for a while:

Thread thd = new Thread(new ThreadStart(runTimer));<br />
<br />
thd.Start();<br />
<br />
void runTimer(){<br />
  while(true) {<br />
    Console.WriteLine("Timer fired");<br />
    Thread.Sleep(1000);<br />
  }<br />
}


You can change the threadmodel of a thread to STA, while keeping the rest in MTA model.
See this MSDN article: http://msdn2.microsoft.com/en-us/library/system.threading.thread.apartmentstate.aspx[^]

Hope this helps a bit to get you going in the right direction.

WM.

What about weapons of mass-construction?

"You can always try to smash it with a wrench to fix that. It might actually work" - WillemM

GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Luc Pattyn7-Jan-07 8:00
sitebuilderLuc Pattyn7-Jan-07 8:00 
QuestionHelp needed converting string hash values into binary... Pin
rvp717y6-Jan-07 12:45
rvp717y6-Jan-07 12:45 
AnswerRe: Help needed converting string hash values into binary... Pin
Guffa6-Jan-07 13:45
Guffa6-Jan-07 13:45 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y6-Jan-07 14:59
rvp717y6-Jan-07 14:59 
GeneralRe: Help needed converting string hash values into binary... Pin
Luc Pattyn6-Jan-07 18:39
sitebuilderLuc Pattyn6-Jan-07 18:39 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y7-Jan-07 5:02
rvp717y7-Jan-07 5:02 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y7-Jan-07 5:44
rvp717y7-Jan-07 5:44 
Question[Message Deleted] Pin
code_wiz6-Jan-07 11:51
code_wiz6-Jan-07 11:51 
AnswerRe: ListView/TreeView controls vs. Databinding in .NET 2.0 Pin
Nader Elshehabi7-Jan-07 2:46
Nader Elshehabi7-Jan-07 2:46 
QuestionC# Monitors [modified] Pin
manustone6-Jan-07 10:27
manustone6-Jan-07 10:27 
AnswerRe: C# Monitors Pin
gnadeem6-Jan-07 11:42
gnadeem6-Jan-07 11:42 
GeneralRe: C# Monitors Pin
manustone8-Jan-07 4:06
manustone8-Jan-07 4:06 
QuestionHow do I send cmds to a dvd drive in C#? Pin
try{}catch{}6-Jan-07 10:06
try{}catch{}6-Jan-07 10:06 
AnswerRe: How do I send cmds to a dvd drive in C#? Pin
Ed.Poore6-Jan-07 11:13
Ed.Poore6-Jan-07 11:13 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
tophor26-Jan-07 15:44
tophor26-Jan-07 15:44 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
Ed.Poore6-Jan-07 18:45
Ed.Poore6-Jan-07 18:45 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
try{}catch{}7-Jan-07 15:18
try{}catch{}7-Jan-07 15:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.