It is possible that your thread(s) didn't start before you called abort.
Try checking the ThreadState before calling abort to see.

-Jeff WS

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of John
Sent: Wednesday, May 28, 2003 2:08 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Thread Abort Exceptions


Hi,

I am running the piece of code below, and I am getting an exception
error
when trying to Abort the threads.   This does not happen consistently
though, it is very random.  What might be the problem here??

Thanks.
John

BarText = "Retrieving data ......"; StartProgThread(ThreadName);
OleDbDataAdapter DataAdapter2 = new OleDbDataAdapter(filterString, cn);
DataAdapter2.Fill (DTable); ThreadTwo.Abort(); BarText = "Writing data
...."; StartProgThread(ThreadName);
dataGrid1.DataSource   = DTable;
ThreadTwo.Abort();
confirmflag = 1;

public void StartProgThread(string TName)
{
ThreadTwo = new Thread (new ThreadStart(DisplayProgBar));
ThreadTwo.Priority = ThreadPriority.AboveNormal; ThreadTwo.Start(); }


public void DisplayProgBar()
{
 Thread current = Thread.CurrentThread;
Console.WriteLine(current.Name);  progress = new ProgressBar(BarText); }

Reply via email to