DLL工程中:自定义控件中的相关代码:
事件定义代码:
现在定义为:(为避免兼容性问题,我增加了一个事件,实际上一个就够了)
Public Event RunAct(ByRef Cancel As Boolean)
Public Event HYAct(ByRef Cancel As Boolean)
原来定义为:
Public Event RunAct(ByRef Cancel As Boolean)
引发事件的相关代码:
Private Sub txtInput_DblClick()
If TableName <> "" And grd.TextMatrix(9, Col) <> "" Then
Dim strCode As String, strName As String, strDate As String, strDate2 As String, Record As ListItem
Select Case UCase(Trim(grd.TextMatrix(9, Col)))
Case "DATE"
If GetDate(strDate) Then txtInput.Text = strDate
Case Else
Dim Cancel As Boolean
'MsgBox "txtInput_DblClick Before RaiseEvent RunAct(Cancel)"
RaiseEvent HYAct(Cancel)
'MsgBox "txtInput_DblClick After RaiseEvent RunAct(Cancel)"
'DoEvents
If Not Cancel Then
'一些默认处理代码
End If
End Select
End If
End Sub
Exe工程中某窗体:引用控件的事件代码:
Private Sub grd_HYAct(Index As Integer, Cancel As Boolean)
MsgBox "grd_RunAct" & Index
End Sub