2
Answers

C# Threading help!! cant seem to get going...

Ask a question
Alex Leslie

Alex Leslie

15y
2.6k
1

Hi all,

 I’ve been stuck with this problem for around two days now, and have been trawling the forums looks for help.

 Any help would be great.

 I have a windows form application which calls external applications, including commandline calls to subversion.

I have a rich textbox on my forum where I redirect the output from cmd to. Everything works great, but the form freezes and the textbox does not show until I do a messagebox.show or something similar. I have come to the conclusion that I need to do the external processes on a worker thread. To be honest I have not got much further than that.

 I have a function called commandLine() which takes various parameters such as command, working dir. etc. im thinking that I should place this on a separate thread but not sure how to go about it as within this function I redirect the output to another function which deals with putting the text into the rtb, and a text file.

 I have been looking at the threading and the backgroundworker, but have no idea how to get started at all!

 Any advice on how to get started, hints and tips, use threading or backgroundworker would be great. Just a quick summary:

Thread needs to take multiple parameters and pass various string values back to the form thread.

 Hope this makes sense!


Answers (2)