|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Closing eventHi,
I want to avoid an user closes the form clicking on the upper right side "X" button. So, for the Closing event, I set: e.cancel = true The problem is, this way the user can't even close the form using the appropriate button Exit (a button built on the form). How can I link a click on Exit to set e.cancel = false, keeping it true otherwise? thanks N! Xau keep in mind the power of Antani http://ilovemiliofede.altervista.org N! Xau wrote:
Show quoteHide quote > Hi, Why not hide the control box for the form so they don't see the "X" > > I want to avoid an user closes the form clicking on the upper right > side "X" button. > So, for the Closing event, I set: > e.cancel = true > > The problem is, this way the user can't even close the form using the > appropriate button Exit (a button built on the form). > How can I link a click on Exit to set e.cancel = false, keeping it true > otherwise? > > thanks > > N! Xau > keep in mind the power of Antani > http://ilovemiliofede.altervista.org > button? Otherwise in your exit button set a boolean variable to true that allows the form to exit. Sub Exit_Click(....) handles Exit.Click blAllowExit = True End Sub In the form.closing event: if not blAllowExit then e.cancel = false End if Hope it helps Chris "N! Xau" <n***@hotmail.com> schrieb: Add the code below to your form in order to disable the "X" button:> I want to avoid an user closes the form clicking on the upper right > side "X" button. > So, for the Closing event, I set: > e.cancel = true > > The problem is, this way the user can't even close the form using the > appropriate button Exit (a button built on the form). > How can I link a click on Exit to set e.cancel = false, keeping it true > otherwise? \\\ Protected Overrides ReadOnly Property CreateParams() As CreateParams Get Dim cp As CreateParams = MyBase.CreateParams Const CS_DBLCLKS As Int32 = &H8 Const CS_NOCLOSE As Int32 = &H200 cp.ClassStyle = CS_DBLCLKS Or CS_NOCLOSE Return cp End Get End Property /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||