WithEvents Problem

AlphaStu

Member
Joined
Mar 4, 2005
Messages
8
Location
UK
Programming Experience
5-10
Please can someone help me with this. I have an assembly that I have written in VB.NET and using in Access 2003. The problem I am having is getting the Private WithEvents to work in Access.

Heres the code I have in VB.NET
-------------------------------------------------------------
Imports System
I
mports System.Runtime.InteropServices

<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)>_
PublicInterface IMyInterface
Property GreetingName() AsString
Sub ShowGreeting()
EndInterface

<ComSourceInterfaces(GetType(IMyInterface))>_
PublicClass NETTest
PublicEvent NameChanged As NameChangedHandler
Dim lgNameStr AsString

PublicProperty GreetingName() AsString
Get
GreetingName = lgNameStr
EndGet

Set(ByVal Value AsString)
lgNameStr = Value
RaiseEvent NameChanged(lgNameStr)
EndSet
EndProperty

PublicSub ShowGreeting()
MsgBox("Hello " & lgNameStr)
EndSub


EndClass
-----------------------------------------------------------------

In Access 2003 when I put 'Private WithEvents NewName As' it can't find anything to do with the above class.

Is there something I am missing?

Thanks in advance

 
Back
Top