VB routine to VB.NET

VB routine to VB.NET

gizmowiebe
Contributor Contributor
1,098 Views
4 Replies
Message 1 of 5

VB routine to VB.NET

gizmowiebe
Contributor
Contributor
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
0 Likes
1,099 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
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.
0 Likes
Message 3 of 5

gizmowiebe
Contributor
Contributor
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
0 Likes
Message 4 of 5

arcticad
Advisor
Advisor
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))
0 Likes
Message 5 of 5

Anonymous
Not applicable
Is there a reason for using late binding?
0 Likes