By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,163 Members | 1,458 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,163 IT Pros & Developers. It's quick & easy.

Close button on a form in VB.Net 2003

P: n/a
Is there anyway to remove the close button on a form, or is there a "On
Close" property? TIA.
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Greg" <Gr**@discussions.microsoft.com> schrieb:
Is there anyway to remove the close button on a form, or is there a "On
Close" property? TIA.


To remove the control box, set the form's 'ControlBox' property to 'False'.

Add a handler to the form's 'Closing' event if you want to be notified when
the form closes. You can set 'e.Cancel = False' there to prevent the form
from closing.

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

Nov 21 '05 #2

P: n/a
Greg,

I find it awful to do things that are in conflict what is beside the normal
habit from users (the same as a car without a steering wheel but a
joystick), however this solution from Mick looks acceptable for me.

\\\by Mick Doherty
Protected Overrides ReadOnly _
Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property
///

I hope this helps a little bit?

Cor
Nov 21 '05 #3

P: n/a
Thanks for your help. Your sugestion solved my problem.
"Greg" wrote:
Is there anyway to remove the close button on a form, or is there a "On
Close" property? TIA.

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.