473,382 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Threading question - please help

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
Jul 21 '05 #1
1 1062
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" <an*******@discussions.microsoft.com> a écrit dans le message de
news:C5**********************************@microsof t.com...
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 thread
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 completes
BindDataGridResults();
Cursor.Current = Cursors.Default;
btnImport.Enabled = true;

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

Thanks,
Edward

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark English | last post by:
Every once in a while since I moved to Python 2.4 I've been seeing the following exception in threading.py Condition: File "mctest3.py", line 1598, in WaitForMessages...
1
by: Tom | last post by:
I've googled, and read, and stripped out code, and rewritten code, and still can't get a System.Threading.Timer to work. (I hereby publicly admit that I'm a failure here...) Could someone please...
8
by: Yatharth | last post by:
Hi, I m new to threading and i have successfully runed threading but i could display value on my web page ,but its working in code behind when i see it through debugger,plzzzzzzz help me here...
2
by: Vjay77 | last post by:
In this code: Private Sub downloadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not (Me.downloadUrlTextBox.Text = "") Then Me.outputGroupBox.Enabled = True...
7
by: Anthony Nystrom | last post by:
What is the correct way to stop a thread? abort? sleep? Will it start up again... Just curious... If the thread is enabling a form, if the form is disposed is the thread as well? Thanks, ...
6
by: venkat | last post by:
Hi, I have a page that calls a sql procedure and it runs for 20 - 40 min. I use usual threading for this page. <code>Thread objthread = new Thread(new ThreadStart(ticketingThread));...
6
by: MobileBoy36 | last post by:
Hi All, I want to make a LogFile class that is thread safe. I use a Mutex for it. But the behavior of the class is not that normal. In a c# guide I read you can achieve it by simply using...
7
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has...
0
ammoos
by: ammoos | last post by:
hi friends pls help me.. i got an assignment which i feel very difficult to me.. i dont have more knowledge about multi-threading in .net... the assignment details is below.... pls help me... i...
4
by: =?Utf-8?B?aG5nbzAx?= | last post by:
All, I am developing a vb.net using threading.... I have a button to print a doc (it takes about 5-10 seconds to finish that process). As soon I click that button I start a thread and then I go...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.