Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pause Code Execution - Wait for User Action ?

Status
Not open for further replies.

blink416

Technical User
Mar 22, 2005
20
GB
Hello !

I have the following problem :

I have a central sub in form A.
e.g.

Code:
Sub CentralCaller()
FeatureA()
FeatureB()
End Sub

and say a sub called FeatureA in a module, which involves use of another form and interaction with a user of my application.
e.g.

Code:
Public Sub FeatureA()
FormB.Show
'and Wait for User to Click Command Button
End Sub

now the problem i have is not knowing the method(s) to use that would allow me to pause execution of CentralCaller, so that FeatureB() is not called before the user presses the command button as part of FeatureA() ? And the obvious solution of sticking FeatureB() under command button click event does not work for me, as I need to leave CentralCaller() as it is, and thus need to pause execution till notified from within FeatureA() ... Any suggestions most appreciated !


p.s. im using VB.NET 2005
p.s.s. My searches have yielded SendMessage, DoEvents, Monitor.Wait, Sleep, WaitForChanged, WaitForSingleObject, but I'm either not sure how to use them or they are not usable for this purpose ...
 
If you need the user to do something on formB before continuing the process, you can open FormB with .ShowModal. The code will not continue from that line until FormB has been closed.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Thanks for such swift replies ! i can put these to use, but ideally i would need not to close a form to conclude FeatureA() [so that FeatureB() could be called from CentralCaller()] ... e.g. if im waiting for the user to just click a command button and that event in itself to allow for continued execution of CentralCaller() ... but leave FormB open ...
 
Thanks for the catch Chrissie.

So you have a process running, that process gets to a point where FormA opens. You want to process to stop until the user clicks on a button, then to continue? And once it continues you don't want FormA to close?

I'm not quite sure I understand where you're going with this. If you don't close FormA and the process has continued on, how/when will FormA get closed? Why can't you put the code into the button on FormA?

I think I'm going to need a better description of what you're trying to do to be of much assistance, sorry.

-Rick


VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top