|
From: John Wright on 10 Jul 2008 13:56 Is there a setting on the form I can set to hide or disable the close button (The Red "X" in the top right of an XP form) so the users cannot exit the program, but still show the min and max buttons. The problem I have is on some of the tabs in my program I have validation events on textboxes. When the users clicks the "X" to close the program, the validation event fires before exiting the program causing some confusion. Thanks. John
From: Kerry Moorman on 10 Jul 2008 14:52 John, If you don't want the validation events to prevent the form from closing then in the form's FormClosing event use: e.Cancel = False Kerry Moorman "John Wright" wrote: > Is there a setting on the form I can set to hide or disable the close button > (The Red "X" in the top right of an XP form) so the users cannot exit the > program, but still show the min and max buttons. The problem I have is on > some of the tabs in my program I have validation events on textboxes. When > the users clicks the "X" to close the program, the validation event fires > before exiting the program causing some confusion. Thanks. > > John > > >
From: kimiraikkonen on 10 Jul 2008 16:20 On Jul 10, 8:56 pm, "John Wright" <riley_wri...(a)hotmail.com> wrote: > Is there a setting on the form I can set to hide or disable the close button > (The Red "X" in the top right of an XP form) so the users cannot exit the > program, but still show the min and max buttons. The problem I have is on > some of the tabs in my program I have validation events on textboxes. When > the users clicks the "X" to close the program, the validation event fires > before exiting the program causing some confusion. Thanks. > > John If i recall correctly this has been discussed before, you need to use that code in your form: ' ----Begin---- Public Class Form1 Private Const CP_NOCLOSE_BUTTON As Integer = 512 Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams Get Dim noclose As CreateParams noclose = MyBase.CreateParams noclose.ClassStyle = CP_NOCLOSE_BUTTON Return noclose End Get End Property ' Codes... End Class ' ----End----- Hope this helps, Onur Güzel
|
Pages: 1 Prev: XElement hell Next: How to compel Panel scrolled using wheel? |