Solved

Wait for thead before executing function

Posted on 2006-07-13
5
207 Views
Last Modified: 2010-04-23
How can I wait for the thread "thread" to execute and finish before calling GETEPP?

Do while thread.stopped = false
application.doevents
loop


doesn't seem to work.


 Public Sub New(ByVal url As String, ByVal DTable As DataTable, ByVal EventCode As String, ByVal Agent As String, ByVal EventInstance As String, ByVal tabC As TabControl, ByVal thegoahead As String)
            m_url = url

         Dim thread As New Threading.Thread(AddressOf StartGetDocument)
            thread.Name = "StartGetDocument"
            thread.Start()

              GetEPP(m_document, DTable, tabC, EventCode, EventInstance, Agent, thegoahead)

        End Sub
0
Comment
Question by:JPERKS1985
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
Nandakumar Sakthivel earned 500 total points
ID: 17105839
Hi,
   why don't you put
                   GetEPP(m_document, DTable, tabC, EventCode, EventInstance, Agent, thegoahead)
   as a last staement in the StartGetDocument) function.it will work for your case

Thanks,
Nanda
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 17105844
I'd have to pass all those parameters i already tried it and I was getting alot of errors.
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 17105851
I'm not sure what the problem is, ive been trying to find the bug for a week now, I'm thinking its a threading issue, the first time I run the thread it works then second time it messes up.
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 17105876
Fixed it! I took out the startgetdocument thread and just put its code in there. Thanks for your help!
0
 
LVL 6

Expert Comment

by:Nandakumar Sakthivel
ID: 17105894
Hi,
   Include some thing like this

                   thread.Name = "StartGetDocument"
                   thread.Start()
                  -->thread.join()
                   GetEPP(m_document, DTable, tabC, EventCode, EventInstance, Agent, thegoahead)

Include thread.join() method as specified above.This will block the main thread until the child thread that you are creating finishes

Thanks,
Nanda
     
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question