Close button on a form in VB.Net 2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there anyway to remove the close button on a form, or is there a "On
Close" property? TIA.
 
Greg said:
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top