?? fields.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 = "Fields"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'--------------------------------
'時間:2001.11.12
'版權:北京用友軟件股份有限公司
'設計:章景峰
'編碼:章景峰
'說明:U8資金管理---實體對象
'--------------------------------
Option Explicit
Private m_Col As Collection
Public Function Append(ID As Long, Name As String, Caption As String, _
Optional EntityID As Long, _
Optional FieldOption As FieldOptionEnum, _
Optional HelpContextID As String, _
Optional Persistent As Boolean = False, _
Optional Value As Variant, _
Optional ReferenceType As Byte = 0, _
Optional RefFldSqc As Long = 666, _
Optional QryFldSqc As Long = 666, _
Optional IsUsed As Boolean = True, _
Optional TaskID As String, _
Optional EditProp As EditPropertyEnum, _
Optional DataType As DataTypeEnum, _
Optional Length As Integer = 255, _
Optional Decimals As Byte = 0, _
Optional AllowNull As Boolean = True, _
Optional DefaultValue As Variant, _
Optional SourceField As String = "", _
Optional Row As Long, _
Optional StartCol As Long, _
Optional EndCol As Long, _
Optional InputCol As Long, _
Optional Min As Double, _
Optional Max As Double, _
Optional sKey As String = "") As FieldObject
'創建新對象
Dim oFO As New FieldObject
'設置傳入方法的屬性
With oFO
.ID = ID
.Name = Name
.Caption = Caption
.EntityID = EntityID
.FieldOption = FieldOption
.HelpContextID = HelpContextID
.Persistent = Persistent
.IsUsed = IsUsed
.TaskID = TaskID
.EditProp = EditProp
.DataType = DataType
.Length = Length
.Decimals = Decimals
.AllowNull = AllowNull
.ReferenceType = ReferenceType
.QryFldSqc = QryFldSqc
.RefFldSqc = RefFldSqc
.SourceField = SourceField
.Row = Row
.StartCol = StartCol
.EndCol = EndCol
.InputCol = InputCol
.Min = Min
.Max = Max
.DefaultValue = DefaultValue
.Value = DefaultValue
If Not IsMissing(Value) Then .Value = Value
End With
Set oFO.Parent = Me
If Len(sKey) = 0 Then
m_Col.Add oFO
Else
m_Col.Add oFO, sKey
End If
'返回已創建的對象
Set Append = oFO
Set oFO = Nothing
End Function
Public Function AppendEx(oFO As FieldObject) As FieldObject
Set oFO.Parent = Me
m_Col.Add oFO, oFO.Name
'返回已創建的對象
Set AppendEx = oFO
End Function
Public Property Get Item(vIndexKey As Variant, Optional itm As ItemEnum = itmIndexOrKey) As FieldObject
Attribute Item.VB_UserMemId = 0
'引用集合中的一個元素時使用。
'vIndexKey 包含集合的索引或關鍵字,這是為什么要聲明為 Variant 的原因
'語法:Set foo = x.Item(xyz) or Set foo = x.Item(5)
If itm = itmIndexOrKey Then
Set Item = m_Col(vIndexKey)
Else
Dim i As Long
For i = 1 To m_Col.Count
If m_Col(i).Caption = vIndexKey Then
Set Item = m_Col(i)
Exit For
End If
Next
End If
End Property
'功能描述:用坐標來定位域對象
Public Property Get ItemByCoordinate(Row As Long, Col As Long) As FieldObject
Dim i As Long
For i = 1 To m_Col.Count
If m_Col(i).Row = Row Then
If m_Col(i).StartCol <= Col And m_Col(i).EndCol >= Col Then
Set ItemByCoordinate = m_Col(i)
Exit For
End If
End If
Next
End Property
Public Property Get Count() As Long
Count = m_Col.Count
End Property
Public Sub Delete(vIndexKey As Variant)
m_Col.Remove vIndexKey
End Sub
Public Property Get NewEnum() As IUnknown
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
'本屬性允許用 For...Each 語法枚舉該集合。
Set NewEnum = m_Col.[_NewEnum]
End Property
Private Sub Class_Initialize()
'創建類后創建集合
Set m_Col = New Collection
End Sub
Private Sub Class_Terminate()
'類終止后破壞集合
Set m_Col = Nothing
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -