⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsperson.cls

📁 远程访问sql server 的源码
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsPerson"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit

'通过Class Builder添加几个属性变量,然后自己手动整理
Private strpsnName As String 'local copy
Private ipsnAge As Integer 'local copy
Private strpsnSex As String 'local copy
Private blnOcurErr As Boolean 'local copy

'To fire this event, use RaiseEvent with the following syntax:
'RaiseEvent DataError[(arg1, arg2, ... , argn)]
Public Event DataError(ByVal errStr As String)

'自定义一个私有变量,该模块级变量存放人员的薪水
Private dblSalary As Double 'User Var

'提供设置薪水的方法
Public Sub SetSalary(ByVal temSalary As Double)
    dblSalary = temSalary
End Sub

'读取薪水的方法
Public Function GetSalary() As Double
    GetSalary = dblSalary
End Function

'只读属性OcurErr,它没有Let方法
'设置该属性,为了在有事件被触发的时候加以标志
Public Property Get OcurErr() As Boolean
    OcurErr = blnOcurErr
End Property

'公共方法,设置人员的基本属性信息
Public Sub SetValue(ByVal sParaName As String, ByVal iParaAge As Integer, ByVal blnParaSex As String)
    If sParaName = vbNullString Then
        RaiseEvent DataError("姓名不能为空")
        '发生事件,设置检测事件的只读属性,该属性只能在类内改动
        '外部程序不能访问该属性
        blnOcurErr = True
        Exit Sub
    End If

    psnName = sParaName
    psnAge = iParaAge
    psnSex = blnParaSex
End Sub

'设置公共属性psnSex的方法
Public Property Let psnSex(ByVal vData As String)
    strpsnSex = vData
End Property

'读取公共属性psnSex的方法
Public Property Get psnSex() As String
    psnSex = strpsnSex
End Property

Public Property Let psnAge(ByVal vData As Integer)
    ipsnAge = vData
End Property

Public Property Get psnAge() As Integer
    psnAge = ipsnAge
End Property

Public Property Let psnName(ByVal vData As String)
    strpsnName = vData
End Property

Public Property Get psnName() As String
    psnName = strpsnName
End Property

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -