Can we use Interfaces and Events together at the same time?

前端 未结 4 2065
情歌与酒
情歌与酒 2020-12-04 09:08

I\'m still trying to wrap my head around how Interfaces and Events work together (if at all?) in VBA. I\'m about to build a large application in Microsoft Access, and I want

4条回答
  •  时光取名叫无心
    2020-12-04 09:35

    Implemented Class

    '   clsHUMAN
    
    Public Property Let FirstName(strFirstName As String)
    End Property
    

    Derived Class

    '   clsEmployee
    
    Implements clsHUMAN
    
    Event evtNameChange()
    
    Private Property Let clsHUMAN_FirstName(RHS As String)
        UpdateHRDatabase
        RaiseEvent evtNameChange
    End Property
    

    Using in form

    Private WithEvents Employee As clsEmployee
    
    Private Sub Employee_evtNameChange()
        Me.cmdSave.Enabled = True
    End Sub
    

提交回复
热议问题