473,385 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Detect Unload Mode?

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
Nov 20 '05 #1
4 5571
"Tom Vukovich" <tv*****@wpsenergy.com> wrote in
news:bj**********@newsfeed.norlight.net:
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
Nov 20 '05 #2
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" <du******@lunchmeatsbcglobal.net> wrote in message
news:Xn**********************************@207.46.2 48.16...
"Tom Vukovich" <tv*****@wpsenergy.com> wrote in
news:bj**********@newsfeed.norlight.net:
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

Nov 20 '05 #3
Hello,

"Tom Vukovich" <tv*****@wpsenergy.com> 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
Nov 20 '05 #4
Danke

Worked Perfect.

tv
"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello,

"Tom Vukovich" <tv*****@wpsenergy.com> 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

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Larry Woods | last post by:
I have a "homegrown" dll that I am using in IIS (VBScript). I need to replace it on a production server, but I don't want to stop/restart server in order to replace the dll. Possible? TIA,...
4
by: Robert Oschler | last post by:
I have a comparison web page that has several iframes that contain documents from external domain web sites. Some of the web sites are "trusted". If they want to change the top level document...
1
by: Matt | last post by:
When the page is refresh, it will first call window_unload() and then call window_load(). The problem is I window_unload() is invoked when the user click close button, or right top icon close...
4
by: JAW | last post by:
I have some tables on DB2 Z/OS 7.1 with SMALLINT, DECIMAL, TIMESTAMP, DATE and CHAR datatypes. I already have unload utilities crafted so I would just like to unload some data on Z/OS for about...
3
by: Woody Splawn | last post by:
I don't know what it's called when the little pencil shows up in the Row Selector portion of the grid but to me it indicates that the user is in edit mode. I would like to detect this condition...
8
by: Luke Matuszewski | last post by:
I have read all posts about how to detect that url have changed to new page and trigger the event handler then eg. function aidLogout(evt) { if(evt) { /* maybe via analyse of evt object i can...
4
by: Dst | last post by:
This is what i'm trying to do: I'm porting a windows app to a web app. I have a webform which will edit some data stored in a database. The data needs to be locked in the database, while editing....
1
by: mark4asp | last post by:
<!-- // How to detect the rendering mode which the browser is currently in (works for IE6). // Ctrl+Shift+s displays indicates whether the browser is in quirks or standards mode. // Detect...
5
by: =?Utf-8?B?QW5keQ==?= | last post by:
As per the question really. Not trying to stop them leaving, but just detect WHEN they leave the site
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.