Threading question - please help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I hope someone could help me

I'm trying to prevent code from running before the thread I created completes. Here's the code snippet

DataTransformerWorker dtw = new DataTransformerWorker(strApplicationFolder, strSupplier
strFile, lblProgress, ProgressBar1)
//create new threa
ThreadStart tdStart = new ThreadStart(dtw.StartProcess)
Thread td = new Thread(tdStart)
td.Start()

*** I want to prevent the code below from running before the td thread complete

BindDataGridResults()
Cursor.Current = Cursors.Default
btnImport.Enabled = true

I don't know before hand how long the td thread lasts. Any suggestions

Thanks
Edward
 
What you could do is to call Thread.Join(). This will block your current
thread until the other thread exited (or an optional timeout expired).
In your example:
td.Join()

José
Edward said:
Hello,

I hope someone could help me.

I'm trying to prevent code from running before the thread I created
completes. Here's the code snippet:
DataTransformerWorker dtw = new
DataTransformerWorker(strApplicationFolder, strSupplier,
 
Back
Top