-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: aamirOnline
Message 3 in Discussion

Hi  
Here is the detailed explanation of 3rd point 
lets create a DotNet Assembly with class CEmp that exposes properties (FirstName, 
LastName, DOB) and raises an event (Senior). Raising an event from DotNet Component 
and consuming it in COM component is done by defining event sink interface in managed 
code and then apply the ComSourceInterfacesAttribute to connect the event sink 
interface to the managed class.

VB.Net CEmp class code       
Imports System
Imports Microsoft.VisualBasic
Imports System.Runtime.InteropServices
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface evtSenior
    Sub Senior()
End Interface
<ComSourceInterfacesAttribute("evtSenior")> _
Public Class CEmp
    Private mstrFirstName As String
    Private mstrLastName As String
    Private mdtDOB As Date
    Public Event Senior()
    Public Property FirstName() As String
        Get
            FirstName = mstrFirstName
        End Get
        Set(ByVal Value As String)
            mstrFirstName = Value
        End Set
    End Property
    Public Property LastName() As String
        Get
            LastName = mstrLastName
        End Get
        Set(ByVal Value As String)
            mstrLastName = Value
        End Set
    End Property
    Public Property DOB() As Date
        Get
            DOB = mdtDOB
        End Get
        Set(ByVal Value As Date)
            mdtDOB = Value
            If DateDiff(DateInterval.Year, Value, Now) > 60 Then
                RaiseEvent Senior()
            End If
        End Set
    End Property
End Class      
regards
m aamir maniar
Syatem Analyst (CWS), Freelance OOPD Consultant
[EMAIL PROTECTED]  

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to