BeginDocumentClose Event in Document Class .NET API Help

I am use the follow code for send the user a custom message when the drawing be for close. But the drawing closes, and the example describes when you excute the method Veto(), you prevent or anulate the close for the drawing.

I take this code the an example from AUTOCAD .NET API, the example is the next:

     _AcAp.Document doc = _AcAp.Application.DocumentManager.MdiActiveDocument;
     doc.BeginDocumentClose += new _AcAp.DocumentBeginCloseEventHandler(docBeginDocClose);

    public void docBeginDocClose(object senderObj, _AcAp.DocumentBeginCloseEventArgs e)
    {
        _AcAp.Document Doc = (_AcAp.Document)senderObj;
        // Display a message box prompting to continue closing the document
        System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show(
                             "El documento "+ Doc.Window.Text+" se esta cerrando" +
                             "\n Tenga en cuenta que esto pausara su actividad \n¿Desea continuar?",
                             "Información",
                             System.Windows.Forms.MessageBoxButtons.YesNo);
        if (result == System.Windows.Forms.DialogResult.No)
        {
            e.Veto();
        }
    }

I hope someone can help me.

This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!