VBEx .net use of .dll

John H.

Member
Joined
Mar 31, 2008
Messages
14
Programming Experience
Beginner
I'm trying to create a .dll in VB Express with multiple functions and subs.

For the .dll program, I create a class module with:
Public Class Class1

Public Function ReturnOne(ByRef MyVar As Integer) As Integer
MyVar = 1
End Function
Public Sub ReturnString(ByRef MyVar As String)
MyVar = "ABCDEF"
End Sub
End Class

For the caller, I create a form with buttons:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyVar1 As Integer
ReturnOne(MyVar1)
TextBox1.Text = MyVar1.ToString
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim MyVar2 As String = "ABCD"
ReturnString(MyVar2)
TextBox1.Text = MyVar2
End Sub
End Class

Along with the form, I have a module with:
Module Module1
Public Declare Function ReturnOne Lib "C:\...\Test_DLL.dll" (ByRef MyVar1 As Integer) As Integer
Public Declare Sub ReturnString Lib "C:\...\Test_DLL.dll" (ByRef MyVar2 As String)
End Module

Upon execution, it tells me that it cannot find the entry point in the .dll. What am I missing?

TIA

John
 
This is just a guess, have you tried:
VB.NET:
Public Shared Class Class1
? I think that'll tell it that the functions are all general and that it doesn't need an entry point. Or it could be that I don't understand the situation enough.
 
Great article! Sure wish I had seen it before reading those other 9,265,129 (or was it 9,265,128?) articles on the web.

I think that my problem was not creating an instance of my class.

Thanks for the help.
 
Back
Top