Hello,

Please help!

I would like to prepare the DLL (Class Library) file in VB.NET and use it in a Windows Application.

After trying many different things, I still cannot make it work.

I have the DLL added to the Reference, if I open it in the Reference list, I can see my function listed. I think I reference the DLL properly in my Windows Application, but I still receive the following error message:
An unhandled exception of type 'System.EntryPointNotFoundException' occurred in firstapplicationwithdll.exe
Additional information: Unable to find an entry point named printmessage in DLL C:\LT\Visual Studio projects\sampledll\bin\sampledll.dll.


I was trying with the following (sampledll.DLL):
My DLL has the following code:
Public Class sampledll
Sub printmessage(ByVal printtext As String)
Dim response As Byte
response = MsgBox(printtext)
End Sub
Function addnum(ByVal input1 As Integer, ByVal input2 As Integer) As Integer
Dim result As Integer
result = input1 + input2
Return result
End Function
End Class



My windows application is very simple. One form with a button to display the messagebox:
Public Class Form1
Inherits System.Windows.Forms.Form

Declare Sub printmessage Lib "C:\LT\Visual Studio projects\sampledll\bin\sampledll.dll" (ByVal printtext As String)

#Region " Windows Form Designer generated code "
#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
printmessage("Working with DLL")
End Sub
End Class


Is there anyone who has any idea what I am missing?

Many thanks in advance for any help!