QueryUnload, Unload and Terminate (about the Event programming in VB6 tutorial)


Hi all,
I've been reading the tutorial "Event programming in VB6", but there's some thing that I don't seem to understand:
The writer says:

There is often some confusion over the three events that occur when a form is being destroyed - the QueryUnload, Unload, and Terminate events. Of the three, the QueryUnload event is the only one which can be cancelled.

But actually the QueryUnload isn't the only one whice can be canceled, the Unload event can be canceled, too. And there's a parameter in that event named Cancel As Integer, which if I set to true, the Unload event is canceled. So, am I getting it wrong or there's a mistake?

Another thing:
The writer says:

Compare the following two statements:
Unload Form1
Set Form1 = Nothing
The first statement will cause the QueryUnload and the Unload events to fire, but only by using the second statement can you force the Terminate event to fire.

Well, I tried putting the second statement in Command1_Click event but it didn't terminate the form, and the Terminate event wasn't raised. I don't really get that point.

I hope I'll find answers to my questions.

Thanks.

If you enjoyed this post, subscribe for updates (it's free)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.