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

Newbie question

3 REPLIES 3
Reply
Message 1 of 4
david_sexton
1734 Views, 3 Replies

Newbie question

I'm starting the transition from VBA to VB .Net, so this is probably incredibly easy. I haven't even started writing my own code yet, just pasting snippets to get a feel for everything. I've put in a sub routine to draw a single line in model space of AutoCAD. Works great. The problem occurs when I create a form and try to call the sub routine from a button. Then I get an "eLockViolation" when I try to open the model space "for write". I'm guessing that it is because AutoCAD is no longer active because this form is active? If that makes any sense? But, even if I hide the form before I call the sub routine, I still get the error.

Any suggestions would be appreciated.

Thanks

Dave

See attachment for the code.
3 REPLIES 3
Message 2 of 4
arcticad
in reply to: david_sexton

Dim myDWG As Document = ApplicationServices.Application.DocumentManager.MdiActiveDocument

Using lock As DocumentLock = myDWG.LockDocument
' do stuff
End Using
---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 3 of 4
david_sexton
in reply to: david_sexton

That did it!! Thanks!
Message 4 of 4
arcticad
in reply to: david_sexton

Your Welcome
---------------------------



(defun botsbuildbots() (botsbuildbots))

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