473,405 Members | 2,261 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,405 software developers and data experts.

A Form's Minimize, Maximize and Close Buttons?

Hello all,
Is there a way I can get into a form's close/minimize/maximize events when
those buttons (the 3 small squared button in the upper right corner of a
form) are clicked? For example, after a user makes changes on the data on
the form and clicks on the form's Close button (instead of updating the
datasource first), I want the program to run the update routine first, then
close the form.
All helps are greatly appreciated.
I'm using Framework 1.1, VB.Net 2003
Stanav.
Nov 21 '05 #1
3 7990
if you want to run code when the user closes the form, use the form close
event, and if you want to run code when the program is closed, use the form
closed event, its in the code window in the dropdown windows
Nov 21 '05 #2
Thanks you, iwdu15. You've answered my question.
Stanav.

"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com...
if you want to run code when the user closes the form, use the form close
event, and if you want to run code when the program is closed, use the
form
closed event, its in the code window in the dropdown windows

Nov 21 '05 #3
"Stanav" <st*******@hotmail.com> schrieb:
Is there a way I can get into a form's close/minimize/maximize events when
those buttons (the 3 small squared button in the upper right corner of a
form) are clicked?


\\\
Private Const WM_SYSCOMMAND As Int32 = &H112

Private Const SC_MAXIMIZE As Int32 = &HF030
Private Const SC_MINIMIZE As Int32 = &HF020
Private Const SC_RESTORE As Int32 = &HF120
Private Const SC_CLOSE As Int32 = &HF060

Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_SYSCOMMAND Then
Select Case m.WParam.ToInt32()
Case SC_MAXIMIZE
Debug.WriteLine("Form gets maximized.")
Case SC_MINIMIZE
Debug.WriteLine("Form gets minimized.")
Case SC_RESTORE
Debug.WriteLine("Form gets restored.")
Case SC_CLOSE
Debug.WriteLine("Form gets closed.")
End Select
End If
MyBase.WndProc(m)
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

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

Similar topics

0
by: Laura Zeafla via .NET 247 | last post by:
I used the .NET forms application wizard. From the form youclick a button and it calls a C++ function through its dll. This function is supposed to pop-up a command prompt window. Something about...
3
by: JSM | last post by:
Hi, Is it possible to remove the minimise, maximise and close buttons on an MDI child form? I know the documentation say all MDI child forms will have these buttons regardless of whether you...
0
by: M.Usman Yousaf | last post by:
Hi I want to move the control Box (on the Caption Box) toward the Left side of the form ,I have also set the RightToLeft property of the Form true,but it only moves the title of the form right...
5
by: Viper | last post by:
.... say, like MS Word opens another instance of himself when you open another document. If you close the first 'Word', the second document remains alive. I can't figure out how to do the same...
0
by: Bill | last post by:
Hi I have a parent child forms. I want the close, maximize, and minimize buttons to be removed. One the child form I have set the maximize and minimize buttons to false. I have the child form...
2
by: jj | last post by:
I have a single threaded application in c# that scans through a file system. While doing this if I try to minimize, maximize buttons on the top,right hand corner of my form do not do as they are...
5
by: smarty | last post by:
I have an example of code that allows and application to minise to the notification tray but how can I override the minimise and close buttons to ensure they always go back to the notify tray...
3
by: philelpko | last post by:
Morning all, 2 questions...... I have disabled the control boxes, minimize/maximize, resize etc on my forms so users cannot do anything other than what the forms allow. The problem is that...
4
by: EmilH | last post by:
Hi, Can anybody show me how to minimize/maximize a window dynamically? I placed buttons for each of these commands and want to place the code which will minimize and maximize the window. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.