|
-
February 26th, 2008, 12:51 PM
#1
Multi Threading
i declare a thread which runs a Sub that just opens up a loading screen while
a query is run on the OS thread. i want to close the loading thread when the
query is done but without using thread.abort(). anyone let me know if there is
a way to do this. If not, i would be ok with using thread.abort() as i dont care
about losing anything from the loading thread because all it does is display a
form on the screen. but i keep getting the ThreadAbortException "Thread was
being aborted" error. so if anyone can help me to hide this error i would really
appreciate it. thanks
-
February 26th, 2008, 07:01 PM
#2
Re: Multi Threading
Hi!, here's some useful information about threads, its in C#, but is easy to understand the basics.
http://www.yoda.arachsys.com/csharp/threads/
As i can remember, when a thread has nothing to do, it ends, so with your call to Abort you're forzing to exit and give an exception to show you why it has been closed.
Hope this information is useful to you
-
February 27th, 2008, 08:56 AM
#3
Re: Multi Threading
thanks for the reply. However the problem is have is that the thread will never stop itself because it is dependent on the OS thread. So i need to abort() the declared thread depending on OS thread. but the ThreadAbortException gets thrown whenever you use Abort(), even if you have a Try Catch on it. I just need to figure out how to not show the error, cause i cant get that to work.
thanks alot, i appreciate any help
-
February 27th, 2008, 11:28 AM
#4
Re: Multi Threading
 Originally Posted by satanorz
Interesting Link. I want to start learning about multithreading, so, I want to translate the code to VB.net.
This c# code I had get from that link:
Code:
using System;
using System.Threading;
public class Test
{
static void Main()
{
Counter foo = new Counter();
ThreadStart job = new ThreadStart(foo.Count);
Thread thread = new Thread(job);
thread.Start();
for (int i=0; i < 5; i++)
{
Console.WriteLine ("Main thread: {0}", i);
Thread.Sleep(1000);
}
}
}
public class Counter
{
public void Count()
{
for (int i=0; i < 10; i++)
{
Console.WriteLine ("Other thread: {0}", i);
Thread.Sleep(500);
}
}
}
have the "using" statement. ¿Is correct to translate it to VB.NET as the "Implements" statement?
-
February 27th, 2008, 01:28 PM
#5
Re: Multi Threading
Hi!, i think that the correct translation to VB.NET will be
Code:
Imports System;
Imports System.Threading;
-
February 28th, 2008, 04:04 AM
#6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|