.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DocumentExtension.CloseAndDiscard is asynchronous

2 REPLIES 2
Reply
Message 1 of 3
AubelecBE
586 Views, 2 Replies

DocumentExtension.CloseAndDiscard is asynchronous

i need to close and discard a document.

i use the right command but after this, i need to open the same document when the user say YES to do this

but my code in acad 2010 for fine not in acad2014.

Try

   DocumentExtension.CloseAndDiscard(Doc)

Catch ComEX as COMException

End Try

.....

If msgbox(.....) = vbYes then

 DocumentCollection.open(....)

.....

 

with this i have when i quit my prog.  2 docs open with the same name    Test.dwg:1   and Test.dwg:2

Test.dwg is not closed when i send the Open command.

 

 

Another question : i need to catch the COMException. if i dont, acad show me a msgbox with continue button and stop button saying, the ComException is not handle in the code....

 

So how is the best use of this command.

 

 

PS : i use the commandfrag session  (my code works fine in acad2010 when i use the framework3.5 and good dll.

 

 

 

 

 

2 REPLIES 2
Message 2 of 3
Littlerubarb
in reply to: AubelecBE

Here is the open 

 

Public Sub OpenDrawing()
Dim strFileName As String = "C:\campus.dwg"
Dim acDocMgr As DocumentCollection = Application.DocumentManager

If (File.Exists(strFileName)) Then
acDocMgr.Open(strFileName, False)
Else
acDocMgr.MdiActiveDocument.Editor.WriteMessage("File " & strFileName & _
" does not exist.")
End If

Message 3 of 3
AubelecBE
in reply to: Littlerubarb

thanks but now i have all on 64b.

i use VS2013 and Acad 2015. no worry now with the code.

 

Acad 2014 and VS2010 is not very good choose.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost