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

Functions not working when called from form

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
JasonSelf
660 Views, 8 Replies

Functions not working when called from form

This is along the same lines of the last post that I had about problems with ReadDwgFile, but I am encountering an unexpected behaviour.

 

When I run a sub that uses ReadDwgFile where the Command method calls it directly it works fine, but if I instantiate that class into the sub for a form button and then call that same sub that has ReadDwgFile in it, it doesn't work.

 

Any ideas?

 

Thanks,

Jason

8 REPLIES 8
Message 2 of 9
chiefbraincloud
in reply to: JasonSelf

Almost all (maybe all) problems I've seen relating to running code from forms (modal or modeless) are caused by not locking the document.  Where to put the document lock depends somewhat on how your code is arranged.

Dave O.                                                                  Sig-Logos32.png
Message 3 of 9
JasonSelf
in reply to: chiefbraincloud

That did it.  Still much for me to learn Smiley Happy thanks

Message 4 of 9

What is all this about 'locking the document'? I'm trying to learn this ridiculously complicated .Net API and I need to run from a form. Any help appreciated.

 

Steven Elliott

When I was a little bitty boy, my grandmother bought me a cute little toy. Silver bells hangin' on a string... she told me it was my ding-a-ling-a-ling!
Message 5 of 9

I feel you pain, I am in the same boat just a bit further upstream 🙂

 

I think the AutoCAD .Net Developer's Guide does a good job at explaining this:

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer%27s%20Guide/index.html

If you type 'Lock Document' into the search it will be the first result.

 

Message 6 of 9

Thanks! I had just come across this before your post came in.

 

It's really hard to believe that AutoDesk considers this setup a suitable replacement for VBA. Considering that, for most of us, I'd bet, customizing AutoCad is a sideline to our normal job, this takes an inordinate amount of time to learn. It is nowhere near as intuitive as VBA was.

Steven Elliott

When I was a little bitty boy, my grandmother bought me a cute little toy. Silver bells hangin' on a string... she told me it was my ding-a-ling-a-ling!
Message 7 of 9

Have a look at the arxdoc.chm

 

 

 

1350i488439DA21C6B39E

You can also find your answers @ TheSwamp
Message 8 of 9
JasonSelf
in reply to: Jeffrey_H

Technically you can still download and install the VBA runtime for autocad, so you are not completely at a loss.  I decided to just go with the flow and start learning the .net API instead of relying on the COM/Interop stuff from VBA.  I rewrote soemthing that I had developed in VBA to .net code and it is much faster and plays nicer with some memory intensive fucntions.

Message 9 of 9

Thanks for the help, guys.

 

Yes, I understand that programming in .Net is vastly more powerful than VBA. But VBA did what we needed it to do and was infinitely easier to use. With great power comes great... pain.

 

I can't just stick with VBA, because I need my application needs to continue working in AutoCAD 2012 and beyond, something I can't do with VBA. And our IT dept. has said that there is no way in heck they are allowing me to use VB6 (VBA's big brother) anymore. So, it is definitely VB.Net or Lisp. I'll take the less painful and more marketable route with .Net.  Robot tongue

Steven Elliott

When I was a little bitty boy, my grandmother bought me a cute little toy. Silver bells hangin' on a string... she told me it was my ding-a-ling-a-ling!

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