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

VB routine to VB.NET

4 REPLIES 4
Reply
Message 1 of 5
gizmowiebe
509 Views, 4 Replies

VB routine to VB.NET

Hello,

I have a few years experience working with VB6 and VBA in combination with AutoCad. Now due to various reasons I would like to switch to VB.NET. For that I have downloaded Visual Basic 2008 Express.

Attached I added a VB routine that I would like to use in Visual Basic 2008 Express.

Does anybody know how to convert this

Thx in advance.

Wiebe
4 REPLIES 4
Message 2 of 5
fantum
in reply to: gizmowiebe

If you just want to get this into VB.NET pretty much as is then:

1) Create a new project.
2) Paste the code into a suitable place - a button click event in a windows app or Sub Main() of a console app.
3) Add references to the AutoCAD and AutoCAD/ObjectDBX type libraries.
4) Import the namespaces you'll be using (unless you want to fully qualify everything) - Autodesk.AutoCAD.Interop and Autodesk.AutoCAD.Interop.Common.
5) Declare your undeclared variables.
6) Fix your unterminated If blocks and For loop.
7) Enjoy.

Caution: Contents may be hot. Your mileage may vary. Results may not be typical.

No bytes were harmed during the production of this post.
Message 3 of 5
gizmowiebe
in reply to: gizmowiebe

Thx fantum for your prompt reply.

I got as far as the function attached. But everytime I get a HRESULT: 0x8007007E error on the blockreference parts.

Any ideas?

Regards

Wiebe
Message 4 of 5
arcticad
in reply to: gizmowiebe

Since you are Late Bound you don't have any type defined.
Use typename instead.

{code}
For Each entity In dbxDoc.ModelSpace
If TypeName(entity) = "IAcadBlockReference" Then
MsgBox(entity.name)
End If
Next entity
{code}
---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 5 of 5
fantum
in reply to: gizmowiebe

Is there a reason for using late binding?

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