The problem is that when you create a new thread in .Net it's an MTA thread, not a single threaded apartment that VFP requires to simulate multi-threading...
I've set up a quick test and changed my code to this:
private void button1_Click(object sender, System.EventArgs e)
{
Thread t = new Thread(new ThreadStart(threadrun));
t.Name = "#1";
t.ApartmentState = ApartmentState.STA;
t.Start();
Thread t2 = new Thread(new ThreadStart(threadrun));
t2.Name = "#2";
t2.ApartmentState = ApartmentState.STA;
t2.Start();
}
public void threadrun()
{
this.listBox1.Items.Insert(0,"Thread Started. " + Thread.CurrentThread.Name + " " + DateTime.Now.ToString());
aspdemos.ASPToolsClass x = new aspdemos.ASPToolsClass();
x.SlowHit(10);
this.listBox1.Items.Insert(0,"Thread Complete. " + Thread.CurrentThread.Name + " " + DateTime.Now.ToString());
}
which works. When I run this both requests return simultaneously (I have a static wait in SlowHit()).
+++ Rick ---