Hi there,
I'm writting a macro in Visual Studio 2008.
I want to check document when I click close on a file in Visual Studio
Editor, and keep the document opening if I find something.
I add check code in DocumentEvents.DocumentClosing, but I don't know how
to prevent the document closing. Could anyone give me some suggestion?
Thanks a lot.
Layman
Jeff Johnson - 17 Jul 2008 23:34 GMT
> I'm writting a macro in Visual Studio 2008.
> I want to check document when I click close on a file in Visual Studio
> Editor, and keep the document opening if I find something.
> I add check code in DocumentEvents.DocumentClosing, but I don't know how
> to prevent the document closing. Could anyone give me some suggestion?
Since the event handler only get a reference to the Document and not an
EventArgs object that has a Cancel property or something similar, I'd be
willing to say that there is no way to prevent the document from being
closed.
Then there's this little tidbit in the help for the DocumentClosing event:
This API supports the .NET Framework infrastructure and is not intended to
be used directly from your code.