Product : Engine, Version : 4.0.0.1017, ArticleID : 41017049

HowTo : Error when destroying for with the VDraw control when command is active.

Article41017049
TypeHowTo
ProductEngine
Version4.0.0.1017
Date Added3/31/2003
Submitted byKim Jong Woo - Neodreams Co., Ltd.
Keywords

Subject

Error when destroying for with the VDraw control when command is active.

Summary

Just sample code.

1. Create a Standard EXE project in Visual Basic. Form1 is created by default.
2. Add two CommandButtons (Command1 and Command2) and VDPro (VDPro1) to Form1.
3. Add the following code to the form.
4. Run the application.
5. Click the Command1 CommandButton.
6. Click the Command2 CommandButton.
7. And, you met the Error Message.

Private Sub Command1_Click()
   VDPro1.CommandAction.Pan
End Sub

Private Sub Command2_Click()
   Unload Me
End Sub

Please let me know how to solve it.

Solution

Before the Unload Me command you should check if a command is active or user input is needed (like in Pan). This check can be done with OpenLoops property and/or JobLoop Event. Before the destroy of the form you have to cancel these with Cancel Sub, Cancel1 Sub or inside the JobLoop event handler.