Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Wait for thead before executing function

Posted on 2006-07-13
5
Medium Priority
?
225 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 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