my background is C# you need to convert the code to VB.Net,
Try like this:
DateTime mdate;
System.Timers.Timer tim;
bool isProcessing = true;
private void button1_Click(object sender, EventArgs e)
{
mdate = DateTime.Now;
tim = new System.Timers.Timer(1000);
tim.Elapsed += new System.Timers.ElapsedEventHandler(tim_Elapsed);
tim.Start();
new Thread(new ThreadStart(doTheJob)).Start();
while (isProcessing)
{
Thread.Sleep(100);
Application.DoEvents();
}
tim.Stop();
}
private void doTheJob()
{
isProcessing = false;
}
void tim_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
TimeSpan ts = DateTime.Now.Subtract(mdate);
label1.Text = ts.Hours + ":" + ts.Minutes + ":" + ts.Seconds + ":" + ts.Milliseconds;
Application.DoEvents();
}
now we are using System.Timers.Timer instead of System.Forms.Timer.