Home All Groups Group Topic Archive Search About
Author
27 Jun 2005 9:40 AM
Sameh Ahmed
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

Author
27 Jun 2005 9:54 AM
Josip Habjan
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
>
Author
27 Jun 2005 10:00 AM
Sameh Ahmed
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
>>
>
>
Author
27 Jun 2005 10:04 AM
Armin Zingler
"Sameh Ahmed" <essop***@hotmail.com> schrieb
> 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
>
>


Catch the Closing event.

Armin