Click here to Skip to main content
15,905,414 members
Home / Discussions / C#
   

C#

 
GeneralRe: .NET and "industrial espionage" Pin
Marc Clifton10-Feb-04 8:38
mvaMarc Clifton10-Feb-04 8:38 
GeneralRe: .NET and "industrial espionage" Pin
Palladino11-Feb-04 3:51
Palladino11-Feb-04 3:51 
GeneralRe: .NET and "industrial espionage" Pin
Palladino12-Feb-04 5:42
Palladino12-Feb-04 5:42 
GeneralTesting .NET remote connection Pin
naxos10-Feb-04 3:53
naxos10-Feb-04 3:53 
GeneralRe: Testing .NET remote connection Pin
Marc Clifton10-Feb-04 4:10
mvaMarc Clifton10-Feb-04 4:10 
GeneralCannot abort thread Pin
Mertli Ozgur Nevres10-Feb-04 3:38
Mertli Ozgur Nevres10-Feb-04 3:38 
GeneralRe: Cannot abort thread Pin
Marc Clifton10-Feb-04 3:59
mvaMarc Clifton10-Feb-04 3:59 
GeneralRe: Cannot abort thread Pin
Kentamanos10-Feb-04 6:04
Kentamanos10-Feb-04 6:04 
GeneralRe: Cannot abort thread Pin
Marc Clifton10-Feb-04 6:24
mvaMarc Clifton10-Feb-04 6:24 
GeneralRe: Cannot abort thread Pin
David Stone10-Feb-04 9:06
sitebuilderDavid Stone10-Feb-04 9:06 
GeneralRe: Cannot abort thread Pin
Marc Clifton10-Feb-04 9:38
mvaMarc Clifton10-Feb-04 9:38 
GeneralRe: Cannot abort thread Pin
David Stone10-Feb-04 10:36
sitebuilderDavid Stone10-Feb-04 10:36 
GeneralRe: Cannot abort thread Pin
Marc Clifton10-Feb-04 13:40
mvaMarc Clifton10-Feb-04 13:40 
Questionhow to draw a X coordinate with a series of datetime data? Pin
Member 185560810-Feb-04 3:22
Member 185560810-Feb-04 3:22 
AnswerRe: how to draw a X coordinate with a series of datetime data? Pin
Alex Korchemniy10-Feb-04 7:20
Alex Korchemniy10-Feb-04 7:20 
Generalinteract 2 way Pin
Blue_Aqua10-Feb-04 3:14
Blue_Aqua10-Feb-04 3:14 
GeneralRe: interact 2 way Pin
Heath Stewart10-Feb-04 11:10
protectorHeath Stewart10-Feb-04 11:10 
GeneralRe: interact 2 way Pin
Blue_Aqua10-Feb-04 18:23
Blue_Aqua10-Feb-04 18:23 
GeneralMultyThreading in C#: Communication between threads Pin
Jasper4C#10-Feb-04 2:46
Jasper4C#10-Feb-04 2:46 
GeneralRe: MultyThreading in C#: Communication between threads Pin
Marc Clifton10-Feb-04 4:17
mvaMarc Clifton10-Feb-04 4:17 
GeneralRe: MultyThreading in C#: Communication between threads Pin
Jasper4C#10-Feb-04 12:08
Jasper4C#10-Feb-04 12:08 
GeneralRe: MultyThreading in C#: Communication between threads Pin
Marc Clifton10-Feb-04 13:38
mvaMarc Clifton10-Feb-04 13:38 
Ok, first off, you can't call ThreadStart() the way you described because you need an instance of the class or the method you're calling has to be static.

If it's static, then anything it manipulates has to be static as well, and that means anything outside of the thread can access it as well, as long as it's static. If you made all the data and methods in ClassA static, then you could simply call ClassA.SetMessage from any thread--main application thread included.

If it's not static, then you need an instance of the object to pass along to the delegate. Since you have the instance, you can also call the SetMessage method from the application thread. For example:

ClassA myClassA=new ClassA();
ThreadStart threadDelegate=new ThreadStart(myClassA.ThreadEntrancePoint);
Thread newThread=new Thread(threadDelegate);
newThread.Start();

// in my main application:
myClassA.SetMessage="foobar";
...


I hope that helps. Note that you probably would want a "lock" statement to bracket the setter.

Marc

Latest AAL Article
My blog
Join my forum!
GeneralBackground compile in C# Pin
mufoxe10-Feb-04 2:24
mufoxe10-Feb-04 2:24 
GeneralRemoting, Events, Interfaces and Assemblies Pin
CyberHawke10-Feb-04 1:35
CyberHawke10-Feb-04 1:35 
GeneralRe: Remoting, Events, Interfaces and Assemblies Pin
Marc Clifton10-Feb-04 1:45
mvaMarc Clifton10-Feb-04 1:45 

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.