Wrox Programmer Forums
|
Visual Studio 2008 For discussing Visual Studio 2008. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2011, 07:00 AM
Authorized User
 
Join Date: Nov 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multithreading VB 2008

Hi,

Question 1: Can a procedure which is launched in thread 1 call another procedure / function ?

Q2: If not, what is the way of calling p2 from p1(threaded) ? Do I need to build a class and include all the called procedures as methods in that class as to be able to call (use) them ?

And all this questions come from a simple need: I need to press pause & stop buttons regarding a procedure that takes a long time to execute.

Cheers,

Mike
 
Old September 14th, 2011, 09:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

HI..

This is more complex that you think, but yes, you can do this kind of things.

Using flags will be a good way...

Maybe you have to read a little about threads?
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old September 14th, 2011, 12:01 PM
Authorized User
 
Join Date: Nov 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can you give me some useful hyperlinks ?
 
Old September 15th, 2011, 04:55 AM
Authorized User
 
Join Date: Nov 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found out how to make it work! Actually, if you don't want it very sophisticated, it's quite simple to break execution of a "long" procedure:

a. define a procedure which sets a breaking flag (Sub BreakProc)
b. start procedure BreakProc in a different thread
c. test the flag in your "long" procedure

(See this very useful and simple link http://www.devx.com/getHelpOn/10Minu...20365/0/page/1 about threads in VB.)

Don't forget to kill the thread of BreakProc after you stopped your "long" procedure.

Cheers,

Mikey

PS. Of course, this is just the tip of the iceberg of working with threads.

Last edited by mike123abc; September 15th, 2011 at 05:00 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.NET 2003 Appendix B convert to VB 2008 Express Edition brucechess BOOK: Beginning VB.NET Databases 10 February 5th, 2009 12:52 PM
why buy vs-2008 instead of vb-2008 jerryham VB.NET 7 September 2nd, 2008 02:39 PM
Multithreading Error in VB.Net abhijeet_1176 General .NET 1 September 5th, 2005 08:49 AM
MultiThreading in vb.net flyin General .NET 0 December 8th, 2004 05:50 PM
MultiThreading in VB.NET roytonmoy General .NET 0 December 2nd, 2004 03:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.