PC Review


Reply
Thread Tools Rate Thread

Detect Unload Mode?

 
 
Tom Vukovich
Guest
Posts: n/a
 
      4th Sep 2003
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
 
Reply With Quote
 
 
 
 
Chris Dunaway
Guest
Posts: n/a
 
      4th Sep 2003
"Tom Vukovich" <(E-Mail Removed)> wrote in
news:bj7cj2$97o$(E-Mail Removed):

> 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
 
Reply With Quote
 
Tom Vukovich
Guest
Posts: n/a
 
      4th Sep 2003
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


"Chris Dunaway" <(E-Mail Removed)> wrote in message
news:Xns93EC5C74D1155dunawaycsbcglobalnet@207.46.248.16...
> "Tom Vukovich" <(E-Mail Removed)> wrote in
> news:bj7cj2$97o$(E-Mail Removed):
>
> > 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



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      4th Sep 2003
Hello,

"Tom Vukovich" <(E-Mail Removed)> schrieb:
>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.


http://www.mvps.org/dotnet/dotnet/sa...ndowsandforms/
-> Beispiel "CloseWindow"

http://www.mvps.org/dotnet/dotnet/code/windowsandforms/
-> "Ursache für das Schliessen eines Formulars ermitteln"

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Tom Vukovich
Guest
Posts: n/a
 
      4th Sep 2003
Danke

Worked Perfect.

tv


"Herfried K. Wagner [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello,
>
> "Tom Vukovich" <(E-Mail Removed)> schrieb:
> >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.

>
> http://www.mvps.org/dotnet/dotnet/sa...ndowsandforms/
> -> Beispiel "CloseWindow"
>
> http://www.mvps.org/dotnet/dotnet/code/windowsandforms/
> -> "Ursache für das Schliessen eines Formulars ermitteln"
>
> HTH,
> Herfried K. Wagner
> --
> MVP · VB Classic, VB.NET
> http://www.mvps.org/dotnet
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to detect design mode Jason Microsoft Outlook Program Addins 1 20th Feb 2009 03:21 PM
unload event and change to design mode =?Utf-8?B?TWFyeQ==?= Microsoft Access Form Coding 1 16th Nov 2007 01:10 AM
Detect system goto sleep mode, hibernation mode, switch user, logo =?Utf-8?B?c3RldmU=?= Microsoft C# .NET 3 7th Oct 2005 07:23 PM
unload assembly - AppDomain.Unload does not work as expected =?Utf-8?B?RGllcmsgRHJvdGg=?= Microsoft Dot NET Framework 2 4th Apr 2004 04:06 PM
Mixed mode dll unload problem Francis Tsui Microsoft VC .NET 0 23rd Mar 2004 07:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:40 AM.