hexagon logo

VB.Net - Stop program execution

How can I stop a program from continuing if an error is encountered in my code? I've tried
ActivePartProgram.Quit
ActivePartProgram.Close
but neither have worked... Any ideas?
  • How can I stop a program from continuing if an error is encountered in my code? I've tried
    ActivePartProgram.Quit
    ActivePartProgram.Close
    but neither have worked... Any ideas?


    You need to use windows API to get hold of the 'Execution mode dialog' and 'hit' the cancel button, then you can close or quit.

    I don't have the code to post right now.
  • Seems like there is no need to use the Windows API, apparently the execution dialog objects are exposed through the automation interface:

    CancelExecution Presses the Cancel button if enabled  
     Continue Presses the Continue button if enabled  
     EraseHit Presses the Erase Hit button if enabled  
     Jump Presses the Jump button if enabled  
     NewRow Presses the New Row button if enabled  
     ScaleProbe Presses the Scale Probe button if enabled  
     ScanDone Presses the Scan Done button if enabled  
     Skip Presses the Skip button if enabled  
     StepInto Presses the Step Into button if enabled  
     StepNext Presses the Step Next button if enabled  
     stop Presses the Stop button if enabled  
     Watch Presses the Watch button if enabled  
    
  • Seems like there is no need to use the Windows API, apparently the execution dialog objects are exposed through the automation interface:

    CancelExecution Presses the Cancel button if enabled  
     Continue Presses the Continue button if enabled  
     EraseHit Presses the Erase Hit button if enabled  
     Jump Presses the Jump button if enabled  
     NewRow Presses the New Row button if enabled  
     ScaleProbe Presses the Scale Probe button if enabled  
     ScanDone Presses the Scan Done button if enabled  
     Skip Presses the Skip button if enabled  
     StepInto Presses the Step Into button if enabled  
     StepNext Presses the Step Next button if enabled  
     stop Presses the Stop button if enabled  
     Watch Presses the Watch button if enabled  
    




    Is this new? What version .tlb are you lookig at?
  • event PCDLRN.IMachineEvents_ErrorMsgEventHandler ErrorMsg.
    I'm form China.