Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Close button on a form in VB.Net 2003

0 views
Skip to first unread message

Herfried K. Wagner [MVP]

unread,
Mar 23, 2005, 3:46:23 PM3/23/05
to
"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/>

Cor Ligthert

unread,
Mar 24, 2005, 2:35:09 AM3/24/05
to
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


0 new messages