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

Minimize, Maximize, Closing events ?

Status
Not open for further replies.

hanglam

Programmer
Dec 11, 2002
143
0
0
US
hi,

How do I capture the minimize, maximize and closing events coming from the top-right corner icons in a form ?
I don't want the user to be able to close the application by clicking on the "X" icon on the top-right corner in a form.
Also, I want to be able to implement my own minimize and maximize methods .

In Wisual Basic 6.0, I used to do it by checking the Unload Mode against vbFormControMenu variable.

Thanks,
Scott
 
Just Modify the Form's "Closing" event. Or I think there is actually a property for it. But Ya just modify it so it has some condition that doesn't allow it to close.
 

use Closing event of the Form as follows to prevent the Form from closing when "X" is clicked.

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = True
End Sub


Email: pankajmsm@yahoo.com
 

you can use Activated and Deactivate event of the Form to perform some action when Form is maximized or minimize.


Email: pankajmsm@yahoo.com
 
I did that , but I want to be able to differentiate between the closing event coming from the 'X' icon and a event coming from the Me.Close() command .

Isn't there a neat/better way to tell which source is the command coming from ? If it can be done in VB 6.0, then it has to be able to be done in VB.NET ...

any info is appreciated ..

Thanks,



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top