Digital Paint Discussion Board
Digital Paint Community => Other Stuff => Topic started by: ViciouZ on December 29, 2007, 03:54:56 PM
-
Well I have a next to no experience of C#.
Currently when I start a process, the application freezes until the process has finished and exited. Is there any way I can stop this happening without using threads? The structure of my code stops threads being feasible.
-
No. You need to use threads for there to be more than one thread. :P
There are some objects that make threading a bit easier. But most likely, you're gonna have to hack your code until it can handle threads.
-
Aww you gotta stop using such an extensive loop, you have no choice but mutlithreading, its not that hard, around 2 lines of code will do(note i learn vb.net not c#)
-
.Net provides you with a very easy to use Thread class for multithreading. look it up on msdn.
-
All you have to do is:
private Thread th;
public constructor()
{
CheckForIllegalCrossThreadCalls = false;
th = new Thread(new ThreadStart(MyNewThread));
th.Start();
}
private void MyNewThread()
{
// Add new thread code here.
}
Note the 'constructor' function is the actual constructor of the form, not a function named constructor.