|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Cancel form closeHello there
IS there a way to cancel a form close after the user clicks on the close button? I want to confirm from the user the close operation and if he chooses not to, I would cancel the operation any ideas? Regards Sameh Hi,
** Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing Dim dlgres As DialogResult = _ MessageBox.Show("Are you shure you want to close this widnow?", _ "MyApp", _ MessageBoxButtons.YesNo, _ MessageBoxIcon.Question) If dlgres = DialogResult.No Then e.Cancel = True End If End Sub ** Regards, Josip Habjan URL: http://www.habjansoftware.com Show quoteHide quote "Sameh Ahmed" <essop***@hotmail.com> wrote in message news:uH7X5wveFHA.3376@TK2MSFTNGP10.phx.gbl... > Hello there > IS there a way to cancel a form close after the user clicks on the close > button? > I want to confirm from the user the close operation and if he chooses not > to, I would cancel the operation > any ideas? > Regards > Sameh > thanks so much
e.Cancel = True this is the part I was looking for Show quoteHide quote "Josip Habjan" <jhabjan@SPAM-OFF.net.hr> wrote in message news:d9oicp$7d2$1@magcargo.vodatel.hr... > Hi, > > ** > Private Sub Form1_Closing(ByVal sender As Object, ByVal e As > System.ComponentModel.CancelEventArgs) Handles MyBase.Closing > Dim dlgres As DialogResult = _ > MessageBox.Show("Are you shure you want to close this > widnow?", _ > "MyApp", _ > MessageBoxButtons.YesNo, _ > MessageBoxIcon.Question) > If dlgres = DialogResult.No Then > e.Cancel = True > End If > End Sub > ** > > Regards, > Josip Habjan > URL: http://www.habjansoftware.com > > > > "Sameh Ahmed" <essop***@hotmail.com> wrote in message > news:uH7X5wveFHA.3376@TK2MSFTNGP10.phx.gbl... >> Hello there >> IS there a way to cancel a form close after the user clicks on the close >> button? >> I want to confirm from the user the close operation and if he chooses not >> to, I would cancel the operation >> any ideas? >> Regards >> Sameh >> > > "Sameh Ahmed" <essop***@hotmail.com> schrieb Catch the Closing event.> Hello there > IS there a way to cancel a form close after the user clicks on the > close button? > I want to confirm from the user the close operation and if he > chooses not to, I would cancel the operation > any ideas? > Regards > Sameh > > Armin |
|||||||||||||||||||||||