- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've recently had success with creating a .NET Joint in C#. I am now trying to create the same code using VB.NET.
I ran into the same error code I was getting when I was trying to create a C# .NET Joint. (The thread I am referring to is Issues with Advance Steel Walkthrough - .NET Connections ) In the end, it turns out that I was using the wrong class library template in Visual Studio.
I have verified that I am using the .NET Framework 4.7.2 for this project; the same as the C# project and I believe I am using the correct class this time. However, I get the following error when I try to run the code.
This seems to be a generic error. Trying to debug this doesn't seem to work as the Query subroutine is not running before the error is generated.
Does anyone know if it is possible to write a .NET Connection in VB.NET? Or, does it have to be a C# program? I can't find anywhere that would indicate that this is the case. I am assuming that they both produce the same result when they build/compile the project into the *.dll file. (Maybe I am wrong?)
There are some differences I have noted between the way the IRule interface is implemented in C# vs VB.NET. Below is the C# and VB.NET code that gets generated when you add the IRule interface to the class.
C# Code:
using System;
using Autodesk.AdvanceSteel.ConstructionTypes;
namespace MyNetJointInterface
{
public class MyNetJoint : IRule
{
public Autodesk.AdvanceSteel.CADLink.Database.ObjectId JointId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public void CreateObjects()
{
throw new NotImplementedException();
}
public void GetRulePages(IRuleUIBuilder builder)
{
throw new NotImplementedException();
}
public string GetTableName()
{
throw new NotImplementedException();
}
public void Load(IFiler filer)
{
throw new NotImplementedException();
}
public void Query(IUI ui)
{
throw new NotImplementedException();
}
public void Save(IFiler filer)
{
throw new NotImplementedException();
}
}
}
VB.NET Code:
Imports Autodesk.AdvanceSteel.CADLink.Database
Imports Autodesk.AdvanceSteel.ConstructionTypes
Namespace MyNetJointInterface
Public Class MyNetJoint
Implements IRule
Public Property JointId As ObjectId Implements IRule.JointId
Get
Throw New NotImplementedException()
End Get
Set(value As ObjectId)
Throw New NotImplementedException()
End Set
End Property
Public Sub Query(ui As IUI) Implements IRule.Query
Throw New NotImplementedException()
End Sub
Public Sub CreateObjects() Implements IRule.CreateObjects
Throw New NotImplementedException()
End Sub
Public Sub Save(filer As IFiler) Implements IRule.Save
Throw New NotImplementedException()
End Sub
Public Sub Load(filer As IFiler) Implements IRule.Load
Throw New NotImplementedException()
End Sub
Public Sub GetRulePages(builder As IRuleUIBuilder) Implements IRule.GetRulePages
Throw New NotImplementedException()
End Sub
Public Function GetTableName() As String Implements IRule.GetTableName
Throw New NotImplementedException()
End Function
End Class
End Namespace
I have attached the working C# implementation and the translated VB.NET code.
Solved! Go to Solution.