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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop execution of VB code after the statement "Action =1"

Status
Not open for further replies.

murtazam

Programmer
Jan 8, 2002
2
PK
Hi :)

I am using Crystal Report control with Visual Basic 6.
I want to have some user interaction after user has veiwed the report in crystal preview pane, so i need to stop furthur execution of VB code after the statement "Action = 1", untill user has viewed and close the crystal preview pane.
So please let me know how to stop this execution of VB code just after the statement "Action =1", Untill crystal preview pane is closed.

Thanks,
Murtaza
 
Unusual Requirement but...
There are several ways. Below is a simple way.

Put a loop after the action = 1 statement with a Find Window API call that loop until Findwindow fails to find the crystal window. Inside the loop is Doevents

.Action =1
Do WHILE FindWindow(parm0,parm1,...) <> 0
DoEvents
Loop
...
...
Rest of Code Here


Insteand of FindoWindow you can use other thread based APIs


 
Remember that VB6 is an event-controlled environment. Nothing happens until an event fires.

If you print the report at the end of a sub, the report will get sent to the viewer, and VB6 will wait for the next event, a click, keypress, etc. Unless you've called that sub from a sub that has more lines after the call, but you shouldn't - the call to Crystal should be generated by a menu click or a button click, or some other event. No events, no user-written code being executed. (Of course VB is still spinning the &quot;While not Quit Wend&quot; wheel like mad.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top