Click here to Skip to main content
16,007,885 members
Home / Discussions / C#
   

C#

 
GeneralRe: Searching XmlDocument Pin
Christian Graus13-Aug-02 13:10
protectorChristian Graus13-Aug-02 13:10 
GeneralForcing a whole line scrolling in a RichTextBox Pin
Nnamdi Onyeyiri13-Aug-02 11:53
Nnamdi Onyeyiri13-Aug-02 11:53 
GeneralRe: Forcing a whole line scrolling in a RichTextBox Pin
albean13-Aug-02 12:35
albean13-Aug-02 12:35 
GeneralRe: Forcing a whole line scrolling in a RichTextBox Pin
Nnamdi Onyeyiri13-Aug-02 21:28
Nnamdi Onyeyiri13-Aug-02 21:28 
QuestionHow to pass arguments to a thread? Pin
Rickard Andersson2013-Aug-02 11:07
Rickard Andersson2013-Aug-02 11:07 
AnswerRe: How to pass arguments to a thread? Pin
albean13-Aug-02 12:04
albean13-Aug-02 12:04 
GeneralRe: How to pass arguments to a thread? Pin
Rickard Andersson2014-Aug-02 0:44
Rickard Andersson2014-Aug-02 0:44 
AnswerRe: How to pass arguments to a thread? Pin
James T. Johnson13-Aug-02 21:24
James T. Johnson13-Aug-02 21:24 
It depends on how you create your thread.

The "easy" way is to create a delegate matching the method signature and call the delegate with BeginInvoke. This will cause the delegates method to run in a thread pool thread and you get to pass your parameters in. This is a 'fire and forget' method though; so you don't get access to the underlying Thread object in your main code.

The "hard" way is to create a class specifically for the thread, with the parameters passed in to the constructor or set as properties. The thread's run method is then made public so that it can be started via the ThreadStart delegate. This method gives you far more control over the thread itself; including being able to work on the underlying Thread object.

Remember above all else, if you are modifying the GUI in someway from any thread you absolutely must use the GUI object's Invoke or BeginInvoke/EndInvoke methods to do anything to the GUI object itself. Not doing so is baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad mojo and will eventually break. All GUI object's expose an InvokeRequired property which tells you whether or not you have to call Invoke or BeginInvoke/EndInvoke. Look in the articles I've done for a sample of doing this.

James
"And we are all men; apart from the females." - Colin Davies
GeneralRe: How to pass arguments to a thread? Pin
Rickard Andersson2014-Aug-02 0:41
Rickard Andersson2014-Aug-02 0:41 
GeneralRe: How to pass arguments to a thread? Pin
Nish Nishant14-Aug-02 1:21
sitebuilderNish Nishant14-Aug-02 1:21 
GeneralRe: How to pass arguments to a thread? Pin
Rickard Andersson2014-Aug-02 1:37
Rickard Andersson2014-Aug-02 1:37 
GeneralFillReversibleRectangle Pin
albean13-Aug-02 10:38
albean13-Aug-02 10:38 
GeneralRe: FillReversibleRectangle Pin
James T. Johnson13-Aug-02 21:42
James T. Johnson13-Aug-02 21:42 
GeneralRe: FillReversibleRectangle Pin
albean14-Aug-02 5:43
albean14-Aug-02 5:43 
Generalsome mixed questions.... Pin
Anonymous13-Aug-02 10:33
Anonymous13-Aug-02 10:33 
GeneralRe: some mixed questions.... Pin
albean13-Aug-02 12:56
albean13-Aug-02 12:56 
Questionhow to moniter user actions on different controls Pin
imran_rafique13-Aug-02 10:18
imran_rafique13-Aug-02 10:18 
AnswerRe: how to moniter user actions on different controls Pin
albean13-Aug-02 12:46
albean13-Aug-02 12:46 
GeneralWndProc Messages Pin
Nnamdi Onyeyiri13-Aug-02 6:44
Nnamdi Onyeyiri13-Aug-02 6:44 
GeneralRe: WndProc Messages Pin
leppie13-Aug-02 7:30
leppie13-Aug-02 7:30 
GeneralRe: WndProc Messages Pin
Rickard Andersson2013-Aug-02 7:39
Rickard Andersson2013-Aug-02 7:39 
GeneralRe: WndProc Messages Pin
leppie13-Aug-02 8:07
leppie13-Aug-02 8:07 
GeneralRe: WndProc Messages Pin
Nnamdi Onyeyiri13-Aug-02 9:59
Nnamdi Onyeyiri13-Aug-02 9:59 
GeneralRe: WndProc Messages Pin
leppie13-Aug-02 12:28
leppie13-Aug-02 12:28 
GeneralRe: WndProc Messages Pin
Nnamdi Onyeyiri13-Aug-02 21:25
Nnamdi Onyeyiri13-Aug-02 21:25 

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.