Detect Unload Mode?

  • Thread starter Thread starter Tom Vukovich
  • Start date Start date
T

Tom Vukovich

Hi All,
I have an application that I am porting from VB6 to VBNet and in vb6 i can detect the unloadMode. DotNet doesn't support this but I need the functionality. I understand the code should be in the 'closing' event of the form but can't seem to find any help on what to look for. I only want the form to unload if the user selects unload from the File|exit menu item. If they click the X in the corner i just want to hide the form and put an icon in the system tray. Any help would be appreciated.

TV

If UnloadMode = vbFormControlMenu Then
Me.Hide()
Cancel = True
End If
 
only want the form to unload if the user selects unload from the
File|exit menu item. If they click the X in the corner i just want to
hide the form and put an icon in the system tray. Any help would be

One simple method would be to use a boolean variable. In the menuitem
click event for File|exit, set a boolean variable to True. Then in the
closing event if that variable is set, you know they clicked the menu.
Otherwise, they clicked the X.

Chris
 
I thought of that way but i figured there may be a better way to detect the
closing mode. The close could come from the system, menu, close button
etc....and i could then have a generic procedure to use in other apps.
Thanks for your response.

tv
 
Back
Top