Close button on a form in VB.Net 2003

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg

    Close button on a form in VB.Net 2003

    Is there anyway to remove the close button on a form, or is there a "On
    Close" property? TIA.
  • Herfried K. Wagner [MVP]

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

    "Greg" <Greg@discussio ns.microsoft.co m> schrieb:[color=blue]
    > Is there anyway to remove the close button on a form, or is there a "On
    > Close" property? TIA.[/color]

    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/>

    Comment

    • Cor Ligthert

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

      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.CreatePa rams
      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


      Comment

      • Greg

        #4
        RE: Close button on a form in VB.Net 2003

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

        Comment

        Working...