• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Active Contributor
    cincir
    Posts: 32
    Registered: ‎08-12-2011

    BeginDocumentClose - Save confirmation messagebox

    188 Views, 3 Replies
    01-19-2012 11:06 AM

    Hi everyone

    I am handling BeginDocumentClose event of a Document but before my code executes MessageBox pops up asking me if a want to save my changes. Any idea how can i suppress it? Because i am asking use to end the process for this Document and if the user chooses No i am Vetoing the close so no need to Save changes.

    Please use plain text.
    Distinguished Contributor
    VB_Autocad_guy
    Posts: 136
    Registered: ‎07-24-2009

    Re: BeginDocumentClose - Save confirmation messagebox

    01-20-2012 07:54 AM in reply to: cincir

    Okay Here's a possible trick: 

     

    VBA Command way... meaning you just use .SendCommand(blah blah blah)


    I took the idea from here... Forum Topic - Close without save

     

    1st solution
    (command "._VBASTMT" "ThisDrawing.Application.ActiveDocument.Close(vbFalse)")

    2nd solution
    (command "_.vbastmt" "thisdrawing.close vbfalse")

     

    or Vb.NET

     

    -But then you have to VBA enabled... hmmm that might not work for you.

     

    Or close the document before Autocad can. 

     

    Sean has some stuff on this: 

     

    http://through-the-interface.typepad.com/through_the_interface/2007/03/closing_all_ope.html

     

    Hmm... see code & methods would be ... ah ...

     

    Methods:

    Document.CloseAndDiscard 
    Document.CloseAndSave
    DocumentCollection.CloseAll

    Something along those lines. 

     

    Why are you using the begindocumentclose event anyhow? 

     

    Is any of this along the lines of what you're looking for? Best of luck. :smileyhappy:

     

    Cheers.

     

     

     

    Please use plain text.
    Active Contributor
    cincir
    Posts: 32
    Registered: ‎08-12-2011

    Re: BeginDocumentClose - Save confirmation messagebox

    01-20-2012 09:32 AM in reply to: VB_Autocad_guy

    :smileyhappy: although none of them is working for me , the way you wrote them may help making my mood :smileyhappy:

     

    thanks anyway. here is a brief explanation ;

     

    i am executing a command that shows a paletteset and allow user to make modifications by the commands on paletteset. if the user clicks the close button on my paletteset there is no problem. but if the user clicks the x button of document i want to ask user if he/she wants to exit modification process that i am serving. but the autocads save changes messagebox first pops up then mine. it makes an ignoring step when the user refuses to close my modification process.

     

    i think it is clearer now.

    :smileywink:

    Please use plain text.
    Active Contributor
    cincir
    Posts: 32
    Registered: ‎08-12-2011

    Re: BeginDocumentClose - Save confirmation messagebox

    01-20-2012 09:36 AM in reply to: cincir

    But i can use the "DBMOD" variable and store its current value and if i can set it to no modifications made constant then no popup . if it can be set ofcourse. but i think i got the qlue. 

     

    thanks.

     

    bad news autocad invokes dialog before BeginDocumentClose event. i better try to set DBMOD in CommandWillStart event.

    Please use plain text.