It says it’s possible, but after I build the dll it’s not in the Active X references anywhere. I am currently using VS 2010 express to build the dll but the blog says that should be ok. What am I doing wrong?
You cannot use .NET objects directly in Xojo. There was a Xojo blog in the past year that outlined how to wrap a .NET dll for use with Xojo, and I believe @Michel Bujardet has had success doing so. Search through the official Xojo blog and Michel’s posts.
Hmmm that’s the one I was trying to use. Maybe I should use Visual Studio 2012 instead of 2010. I made it COM Visible but it doesn’t show up in the references. Thanks.
Actually, I followed scrupulously the blog post, and it worked right away. Then I built a DLL in VB. NET exactly the same way and it worked just the same.
I do not know what maybe happening with the OP. Maybe he needs to start over and really make sure to respect every step. In particular, if COM does not show something must be missing.
Do I need to save or copy the dll to a specific place? Things are named a little differently in 2010 than 2012 but I tried to follow the blog and replicate it exactly. I am using Visual Basic 2010 Express, does it have to be in C#, could that be the issue? I’m new to VB, I have vb files not cs files. Does that make a difference? Thanks!
Also, since I suppose you will be generating the DLL on the same machine as the one you will have the Xojo program on, you do not need to register the DLL. The system will know where it is.
@Michel Bujardet, @Tim Hare I was able to create the DLL using Visual Basic in Visual Studio 2012 with “Register for Com interop” and Xojo can Insert it using the Active X references. I can see the public class and create it in Xojo but I can’t access the containing methods to return the data I need to Xojo.
My VB Class is named ReadAInput and the DLL is named GetReading.
VB DLL Class:
[code]Public Class ReadAInput
Dim strResult = GetInput()
Public Function GetInput() As String
Dim mydaqboard As New MccDaq.MccBoard(0)
Dim dataval As System.Int16
Dim engunit As Single
mydaqboard.AIn(0, MccDaq.Range.Bip10Volts, dataval)
mydaqboard.ToEngUnits(MccDaq.Range.Bip10Volts, dataval, engunit)
Return engunit
End Function
End Class[/code]
Xojo can use this code fine:
Dim Input As New GetReading.ReadAInput
The method in the DLL class is called GetInput() and it returns a string, how do I get Xojo to access the method inside the class?