Digital Paint Discussion Board

Digital Paint Community => Other Stuff => Topic started by: ViciouZ on December 29, 2007, 03:54:56 PM

Title: Visual C# help
Post 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.
Title: Re: Visual C# help
Post by: Eiii on December 29, 2007, 04:47:28 PM
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.
Title: Re: Visual C# help
Post by: Loser on January 01, 2008, 04:14:39 AM
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#)
Title: Re: Visual C# help
Post by: Deranged on January 01, 2008, 12:14:46 PM
.Net provides you with a very easy to use Thread class for multithreading. look it up on msdn.
Title: Re: Visual C# help
Post by: Cobo on January 01, 2008, 03:01:26 PM
All you have to do is:
Code: [Select]
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.