<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: eLockViolation when trying to draw from a command on a form in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348042#M84727</link>
    <description>Welcome to the forum &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
See post #2 from there:&lt;BR /&gt;
http://discussion.autodesk.com/forums/thread.jspa?messageID=6235293?&lt;BR /&gt;
&lt;BR /&gt;
~'J'~

Edited by: hallex on Mar 8, 2010 7:38 PM</description>
    <pubDate>Mon, 08 Mar 2010 19:38:10 GMT</pubDate>
    <dc:creator>Hallex</dc:creator>
    <dc:date>2010-03-08T19:38:10Z</dc:date>
    <item>
      <title>eLockViolation when trying to draw from a command on a form</title>
      <link>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348038#M84723</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I am getting the following error "An unhandled exception of type &lt;BR /&gt;
'Autodesk.AutoCAD.Runtime.Exception' occurred in acdbmgd.dll Additional &lt;BR /&gt;
information: eLockViolation" when trying to draw (using the sample in Lab3) &lt;BR /&gt;
from a form button command. I couldn't get a normal windows app to reference &lt;BR /&gt;
autocad so I added a form to a class library then show it from autocad. The &lt;BR /&gt;
eLockViolation occurrs when I get to the line Dim bt As BlockTable = &lt;BR /&gt;
trans.GetObject(db.BlockTableId, OpenMode.ForWrite). This all runs OK when &lt;BR /&gt;
it is started from the command prompt but when started from a button on the &lt;BR /&gt;
form the error happens.&lt;BR /&gt;
&lt;BR /&gt;
Does anyone have any idea how to cure this. I can read data fine from other &lt;BR /&gt;
button commands on the form so it is addressing the drawing OK.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
Simon&lt;BR /&gt;
&lt;BR /&gt;
Public Function CreateEmployee()&lt;BR /&gt;
Dim db As Database = HostApplicationServices.WorkingDatabase()&lt;BR /&gt;
&lt;BR /&gt;
Dim trans As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt;
&lt;BR /&gt;
Try&lt;BR /&gt;
&lt;BR /&gt;
ERROR HERE&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;Dim bt As BlockTable = trans.GetObject(db.BlockTableId, &lt;BR /&gt;
OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
Dim btr As BlockTableRecord = trans.GetObject(bt(btr.ModelSpace), &lt;BR /&gt;
OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
'Create the block reference...use the return from CreateEmployeeDefinition &lt;BR /&gt;
directly!&lt;BR /&gt;
&lt;BR /&gt;
Dim br As New BlockReference(New Point3d(10, 10, 0), &lt;BR /&gt;
CreateEmployeeDefinition())&lt;BR /&gt;
&lt;BR /&gt;
btr.AppendEntity(br) 'Add the reference to ModelSpace&lt;BR /&gt;
&lt;BR /&gt;
trans.AddNewlyCreatedDBObject(br, True) 'Let the transaction know about it&lt;BR /&gt;
&lt;BR /&gt;
trans.Commit()&lt;BR /&gt;
&lt;BR /&gt;
Finally&lt;BR /&gt;
&lt;BR /&gt;
trans.Dispose()&lt;BR /&gt;
&lt;BR /&gt;
End Try&lt;BR /&gt;
&lt;BR /&gt;
End Function</description>
      <pubDate>Wed, 08 Jun 2005 12:36:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348038#M84723</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-08T12:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: eLockViolation when trying to draw from a command on a form</title>
      <link>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348039#M84724</link>
      <description>Try locking the document before opening the block table for write.</description>
      <pubDate>Wed, 08 Jun 2005 13:24:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348039#M84724</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-08T13:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: eLockViolation when trying to draw from a command on a form</title>
      <link>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348040#M84725</link>
      <description>Is it not something to do with Document.LockDocument() method. see LAB 6&lt;BR /&gt;
&lt;BR /&gt;
Laurence&lt;BR /&gt;
&lt;BR /&gt;
"Simon" &lt;SIMON.WOOD&gt; wrote in message &lt;BR /&gt;
news:4868495@discussion.autodesk.com...&lt;BR /&gt;
Hi,&lt;BR /&gt;
&lt;BR /&gt;
I am getting the following error "An unhandled exception of type&lt;BR /&gt;
'Autodesk.AutoCAD.Runtime.Exception' occurred in acdbmgd.dll Additional&lt;BR /&gt;
information: eLockViolation" when trying to draw (using the sample in Lab3)&lt;BR /&gt;
from a form button command. I couldn't get a normal windows app to reference&lt;BR /&gt;
autocad so I added a form to a class library then show it from autocad. The&lt;BR /&gt;
eLockViolation occurrs when I get to the line Dim bt As BlockTable =&lt;BR /&gt;
trans.GetObject(db.BlockTableId, OpenMode.ForWrite). This all runs OK when&lt;BR /&gt;
it is started from the command prompt but when started from a button on the&lt;BR /&gt;
form the error happens.&lt;BR /&gt;
&lt;BR /&gt;
Does anyone have any idea how to cure this. I can read data fine from other&lt;BR /&gt;
button commands on the form so it is addressing the drawing OK.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
Simon&lt;BR /&gt;
&lt;BR /&gt;
Public Function CreateEmployee()&lt;BR /&gt;
Dim db As Database = HostApplicationServices.WorkingDatabase()&lt;BR /&gt;
&lt;BR /&gt;
Dim trans As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt;
&lt;BR /&gt;
Try&lt;BR /&gt;
&lt;BR /&gt;
ERROR HERE&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;Dim bt As BlockTable = trans.GetObject(db.BlockTableId,&lt;BR /&gt;
OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
Dim btr As BlockTableRecord = trans.GetObject(bt(btr.ModelSpace),&lt;BR /&gt;
OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
'Create the block reference...use the return from CreateEmployeeDefinition&lt;BR /&gt;
directly!&lt;BR /&gt;
&lt;BR /&gt;
Dim br As New BlockReference(New Point3d(10, 10, 0),&lt;BR /&gt;
CreateEmployeeDefinition())&lt;BR /&gt;
&lt;BR /&gt;
btr.AppendEntity(br) 'Add the reference to ModelSpace&lt;BR /&gt;
&lt;BR /&gt;
trans.AddNewlyCreatedDBObject(br, True) 'Let the transaction know about it&lt;BR /&gt;
&lt;BR /&gt;
trans.Commit()&lt;BR /&gt;
&lt;BR /&gt;
Finally&lt;BR /&gt;
&lt;BR /&gt;
trans.Dispose()&lt;BR /&gt;
&lt;BR /&gt;
End Try&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;/SIMON.WOOD&gt;</description>
      <pubDate>Wed, 08 Jun 2005 13:45:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348040#M84725</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-08T13:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: eLockViolation when trying to draw from a command on a form</title>
      <link>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348041#M84726</link>
      <description>Hi,&lt;BR /&gt;
I'm starting programing with autocad and vb.net and I'm getting the same error in the same situation.&lt;BR /&gt;
And my question is: Did you resolve this problem? I've been serching for a solution, but I cannot find anything about "elockViolation" error.&lt;BR /&gt;
&lt;BR /&gt;
I really apreciate your answer, thanks.&lt;BR /&gt;
&lt;BR /&gt;
Jordi J.</description>
      <pubDate>Mon, 08 Mar 2010 13:32:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348041#M84726</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-08T13:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: eLockViolation when trying to draw from a command on a form</title>
      <link>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348042#M84727</link>
      <description>Welcome to the forum &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
See post #2 from there:&lt;BR /&gt;
http://discussion.autodesk.com/forums/thread.jspa?messageID=6235293?&lt;BR /&gt;
&lt;BR /&gt;
~'J'~

Edited by: hallex on Mar 8, 2010 7:38 PM</description>
      <pubDate>Mon, 08 Mar 2010 19:38:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348042#M84727</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2010-03-08T19:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: eLockViolation when trying to draw from a command on a form</title>
      <link>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348043#M84728</link>
      <description>I had similar problem with the same error by using modeless dialog in my application. &lt;BR /&gt;
&lt;BR /&gt;
Dolument.LockDocument()&lt;BR /&gt;
&lt;BR /&gt;
before opening BlockTable solved my problem</description>
      <pubDate>Fri, 26 Mar 2010 10:10:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/elockviolation-when-trying-to-draw-from-a-command-on-a-form/m-p/1348043#M84728</guid>
      <dc:creator>marty76</dc:creator>
      <dc:date>2010-03-26T10:10:32Z</dc:date>
    </item>
  </channel>
</rss>

