其他分享
首页 > 其他分享> > ACCESS 中的类

ACCESS 中的类

作者:互联网

Option Compare Database
Dim col As New Collection

Private Sub Form_Close()
    Set col = Nothing                    '这里很重要,如果不释放,程序会不稳定,随时挂掉
End Sub

'调用
  '设置textbox样式
        Dim temp As Control
        For Each temp In .Controls    '遍历所有控件,把符合条件的控件添加事件
            If Left(temp.Name, 2) = "T0" And TypeName(temp) = "TextBox" Then
                col.Add New Ctextbox
                Set col.Item(col.Count).myt = temp
                '以下这几句是重点
                col.Item(col.Count).myt.OnGotFocus = "[Event Procedure]"
                col.Item(col.Count).myt.OnLostFocus = "[Event Procedure]"
                col.Item(col.Count).myt.OnClick = "[Event Procedure]"
                col.Item(col.Count).myt.OnKeyDown = "[Event Procedure]"
            End If
        Next

标签:Count,temp,myt,ACCESS,Item,col,Procedure
来源: https://www.cnblogs.com/yoooos/p/16392291.html