Well, inside your vb.net class you want to prefix your routines and
properties like this:
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Public Class yourClass 'classname -->yourClass
'note: Imports System.Windows.Forms for using MsgBox func
Private strName As String
Public Sub New()
'initialize private var in constructor
strName = "Anonymous
'note: don't need <ComVisible(True> _ in constructor
End Sub
<ComVisible(True)> _
Public Sub Test1()
MsgBox "Test from vb.net " & strName
End Sub
<ComVisible(True)> _
Public Property testName()
Get
Return strName
End Get
Set(ByVal Value As String)
strName = Value
End Set
End Property
End Class
After making a reference to yourClass.tlb in Access, in a code module
(form or standard) you can do this:
Sub testTLB()
Dim p As yourClass
p.testName "Bill"
Debug.Print p.TestName
Call p.Test1
End Sub
so sub testTLB will print Bill in the Debug window and will bring up a
message box saying
"Test from vb.net Bill
Note: the real horsepower in .Net dlls is in being able to use .Net
functionality outside of .Net like being able to use DataAdapters,
Datasets, etc in Access. No more having to loop through recordsets
between Sql Server and Access or Oracle and Access, etc. being able to
use inheritance, and multithreading straight in Access through a .Net
dll of your design!
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!