.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
VB routine to VB.NET
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
164 Views, 4 Replies
05-28-2009 04:32 AM
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
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
Re: VB routine to VB.NET
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-28-2009 07:20 AM 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.
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.
Re: VB routine to VB.NET
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-28-2009 07:56 AM 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
I got as far as the function attached. But everytime I get a HRESULT: 0x8007007E error on the blockreference parts.
Any ideas?
Regards
Wiebe
Re: VB routine to VB.NET
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-28-2009 08:20 AM 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}
Use typename instead.
{code}
For Each entity In dbxDoc.ModelSpace
If TypeName(entity) = "IAcadBlockReference" Then
MsgBox(entity.name)
End If
Next entity
{code}
---------------------------

“We don’t have a snowball’s chance in a blast furnace of surviving this attack unless every one of our units gets into the fight right now!”

“We don’t have a snowball’s chance in a blast furnace of surviving this attack unless every one of our units gets into the fight right now!”
Re: VB routine to VB.NET
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-28-2009 08:36 AM in reply to:
gizmowiebe
Is there a reason for using late binding?

