Create VB.Net DLL from scratch

Create VB.Net DLL from scratch

Jacques.Grobler
Advocate Advocate
1,439 Views
13 Replies
Message 1 of 14

Create VB.Net DLL from scratch

Jacques.Grobler
Advocate
Advocate

Hi all

 

I am trying to move form iLogic/VBA to Add-ins/DLLs.

I am using Inventor 2017 and VB 2008 Express.

Where do I start? I have had a look at sample files given when installing Inventor as well as tutorials such as this but I seem to constantly get errors, perhaps because the tutorials are outdated, I don't know. I am looking for a typical "Hello World" dll sample to get the wheel rolling. Any suggestions please?

0 Likes
1,440 Views
13 Replies
Replies (13)
Message 2 of 14

dgreatice
Collaborator
Collaborator

Hi,

 

what kind of error?

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 3 of 14

dgreatice
Collaborator
Collaborator

You can find some error, in error list.

 

Capture1.JPG

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 4 of 14

Jacques.Grobler
Advocate
Advocate

Untitled.png

 

And not only with this prewritten add-in but others as well.

These should already be in the correct format if it was written by Autodesk, I would assume?

0 Likes
Message 5 of 14

dgreatice
Collaborator
Collaborator

ok let fix each error,

 

first go to error and show me a screenshot again.

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 6 of 14

Jacques.Grobler
Advocate
Advocate

Tx for the effort, I am just wondering if this is the easiest way for me to learn how to create a dll? If you feel it is, then let's go, else is there not a simpler way to start from the ground up?

0 Likes
Message 7 of 14

dgreatice
Collaborator
Collaborator

with bad luck, that no easiest way "with single click" to fix that.

 

as you know information from tutorial was helpful for me too, you must following that step and check each error base on point 1 to 9 in "How to convert VBA to Addin".

 

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 8 of 14

Jacques.Grobler
Advocate
Advocate

Ok, let's do this...

 

So I have started with the SimpleAddIn provided under the samples folder of the Inventor Installation...

 

Error 2 Type 'CommandTypesEnum' is not defined. C:\Users\Public\Documents\Autodesk\Inventor 2017\SDK\DeveloperTools\Samples\VB.NET\AddIns\SimpleAddIn\AddSlotOptionButton.vb 12 42 SimpleAddIn

Error    3    Type 'ButtonDisplayEnum' is not defined.    C:\Users\Public\Documents\Autodesk\Inventor 2017\SDK\DeveloperTools\Samples\VB.NET\AddIns\SimpleAddIn\AddSlotOptionButton.vb    18    57    SimpleAddIn

 

Public Sub New(ByVal displayName As String, _
                    ByVal internalName As String, _
                    ByVal commandType As CommandTypesEnum, _
                    ByVal clientId As String, _
                    Optional ByVal description As String = "", _
                    Optional ByVal tooltip As String = "", _
                    Optional ByVal standardIcon As Icon = Nothing, _
                    Optional ByVal largeIcon As Icon = Nothing, _
                    Optional ByVal buttonDisplayType As ButtonDisplayEnum = ButtonDisplayEnum.kDisplayTextInLearningMode)

Public Sub New(..., _
                    ByVal commandType As CommandTypesEnum, _
                    ..., _
                    Optional ByVal buttonDisplayType As ButtonDisplayEnum = ButtonDisplayEnum.kDisplayTextInLearningMode)

 

0 Likes
Message 9 of 14

dgreatice
Collaborator
Collaborator

Strange, I have same sample, and working fine with no error. I'm using Inventor 2018 with VS 2015

 

Capture1.JPG

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 10 of 14

Jacques.Grobler
Advocate
Advocate

The sample works in Inventor, but I get the errors in VS as indicated. Could it be because you use a later version of VS?

0 Likes
Message 11 of 14

AlexFielder
Advisor
Advisor

That is more than likely, yes. Visual Studio Community is free (depending on a couple of business-related criteria).

I have seen those kind of errors before myself; to be honest, I'm not sure what the issue was, but I was glad when they went away.

A good starting point in the journey from VBA to .NET is the pinned post at the top of this forum:

 

https://forums.autodesk.com/t5/inventor-customization/check-out-the-self-paced-guide-my-first-plug-i...

 

It will walk you through the steps necessary to get your first plug-in working.

0 Likes
Message 12 of 14

Jacques.Grobler
Advocate
Advocate

I have previously looked at this very tutorial, but this is based on writing a plugin, and not a dll/add-in.  For what I am trying to achieve I need to look at a dll...

 

Should I then have a look at a newer version of VS or just adapt the code for the older version, if possible?

0 Likes
Message 13 of 14

AlexFielder
Advisor
Advisor
The terminology is terrible, but the tutorial I linked to does in fact create a .dll as the output.
0 Likes
Message 14 of 14

Frederick_Law
Mentor
Mentor

Check if VS is referencing Inventor library.

I don't have Inventor on this computer, so its missing.

VB Ref.jpg

 

Also it could be VS2008 doesn't support .Net 4.  Did you install .Net 4 SDK?

0 Likes