?? fieldobject.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 = "FieldObject"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'--------------------------------
'時間:2001.11.12
'版權:北京用友軟件股份有限公司
'設計:章景峰
'編碼:章景峰
'說明:U8資金管理---實體對象
'--------------------------------
Option Explicit
Private m_iID As Long
Private m_sName As String
Private m_sCaption As String
Private m_iEntityID As Long
Private m_iFieldOption As FieldOptionEnum
Private m_sHelpContextID As String
Private m_bPersistent As Boolean
Private m_oParent As Fields
Private m_Value As Variant
Private m_iReferenceType As Byte
Private m_iRefFldSqc As Long
Private m_iQryFldSqc As Long
Private m_bIsUsed As Boolean
Private m_sTaskID As String
Private m_iEditProp As EditPropertyEnum
Private m_iDataType As DataTypeEnum
Private m_iLength As Byte
Private m_iDecimals As Byte
Private m_bAllowNull As Boolean
Private m_DefaultValue As Variant
Private m_sSourceField As String
Private m_iRow As Long
Private m_iStartCol As Long
Private m_iEndCol As Long
Private m_iInputCol As Long
Private m_dblLeft As Double
Private m_dblWidth As Double
Private m_dblInputLeft As Double
Private m_dblInputWidth As Double
Private m_dblTop As Double
Private m_dblHeight As Double
Private m_iMin As Variant
Private m_iMax As Variant
Public Property Let SourceField(ByVal vData As String)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.SourceField = 5
m_sSourceField = vData
End Property
Public Property Get SourceField() As String
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.SourceField
SourceField = m_sSourceField
End Property
Public Property Let ReferenceType(ByVal vData As Byte)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.ReferenceType = 5
m_iReferenceType = vData
End Property
Public Property Get ReferenceType() As Byte
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.ReferenceType
ReferenceType = m_iReferenceType
End Property
Public Property Let Persistent(ByVal vData As Boolean)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.Persistent = 5
m_bPersistent = vData
End Property
Public Property Get Persistent() As Boolean
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Persistent
Persistent = m_bPersistent
End Property
Public Property Set Parent(ByVal vData As Fields)
'當把對象賦值給屬性時在 Set 語句左邊使用。
'Syntax: Set x.Parent = Form1
Set m_oParent = vData
End Property
Public Property Get Parent() As Fields
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Parent
Set Parent = m_oParent
End Property
Public Property Let Value(ByVal vData As Variant)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.Value = 5
Dim iStrLength As Byte
'----去除字符串兩邊的空字符
vData = Trim(vData)
'----空值
If IsNull(vData) Then
m_Value = vData
Exit Property
End If
'----空串
If vData = "" Then
m_Value = Null
Exit Property
End If
Select Case Me.DataType
Case esoString, esoID
iStrLength = LenEx(vData)
If iStrLength > Me.Length Then
Err.Raise vbObjectError + 3001, Me.Name, Me.Caption & "輸入超長,請重新輸入!"
End If
vData = CStr(vData)
Case esoBoolean
vData = CBool(vData)
Case esoDate
If Not IsDate(vData) Then
Err.Raise vbObjectError + 3002, Me.Name, Me.Caption & "輸入有誤,請重新輸入!"
End If
If IsDate(vData) And vData = "0:00:00" Then
Value = "1899-12-30"
Else
vData = CDate(vData)
End If
Case esoLong
If Not IsNumeric(vData) Then
Err.Raise vbObjectError + 3003, Me.Name, Me.Caption & "輸入有誤,請重新輸入!"
End If
vData = CLng(vData)
If Not IsNull(Me.Max) Then
If vData > Me.Max Then
Err.Raise vbObjectError + 3004, Me.Name, Me.Caption & "輸入超出最大值,請重新輸入!"
End If
End If
If Not IsNull(Me.Min) Then
If vData < Me.Min Then
Err.Raise vbObjectError + 3005, Me.Name, Me.Caption & "輸入低于最小值,請重新輸入!"
End If
End If
Case esoCurrency
If Not IsNumeric(vData) Then
Err.Raise vbObjectError + 3003, Me.Name, Me.Caption & "輸入有誤,請重新輸入!"
End If
vData = Format(vData, "#0." & String(Me.Decimals, "#"))
vData = CCur(vData)
If Not IsNull(Me.Max) Then
If vData > Me.Max Then
Err.Raise vbObjectError + 3004, Me.Name, Me.Caption & "輸入超出最大值,請重新輸入!"
End If
End If
If Not IsNull(Me.Min) Then
If vData < Me.Min Then
Err.Raise vbObjectError + 3005, Me.Name, Me.Caption & "輸入低于最小值,請重新輸入!"
End If
End If
Case esoDouble
If Not IsNumeric(vData) Then
Err.Raise vbObjectError + 3003, Me.Name, Me.Caption & "輸入有誤,請重新輸入!"
End If
vData = Format(vData, "#0." & String(Me.Decimals, "#"))
vData = CDbl(vData)
If Not IsNull(Me.Max) Then
If vData > Me.Max Then
Err.Raise vbObjectError + 3004, Me.Name, Me.Caption & "輸入超出最大值,請重新輸入!"
End If
End If
If Not IsNull(Me.Min) Then
If vData < Me.Min Then
Err.Raise vbObjectError + 3005, Me.Name, Me.Caption & "輸入低于最小值,請重新輸入!"
End If
End If
End Select
m_Value = vData
End Property
Public Property Set Value(ByVal vData As Object)
'當把對象賦值給屬性時在 Set 語句左邊使用。
'Syntax: Set x.Value = Form1
Set m_Value = vData
End Property
Public Property Get Value() As Variant
Attribute Value.VB_UserMemId = 0
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Value
If IsObject(m_Value) Then
Set Value = m_Value
ElseIf IsDate(m_Value) And m_Value = "0:00:00" Then
Value = "1899-12-30"
Else
Value = m_Value
End If
End Property
Public Property Let DefaultValue(ByVal vData As Variant)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.DefaultValue = 5
m_DefaultValue = vData
End Property
Public Property Set DefaultValue(ByVal vData As Object)
'當把對象賦值給屬性時在 Set 語句左邊使用。
'Syntax: Set x.DefaultValue = Form1
Set m_DefaultValue = vData
End Property
Public Property Get DefaultValue() As Variant
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.DefaultValue
If IsObject(m_DefaultValue) Then
Set DefaultValue = m_DefaultValue
Else
DefaultValue = m_DefaultValue
End If
End Property
Public Property Let AllowNull(ByVal vData As Boolean)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.AllowNull = 5
m_bAllowNull = vData
End Property
Public Property Get AllowNull() As Boolean
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.AllowNull
AllowNull = m_bAllowNull
End Property
Public Property Let Length(ByVal vData As Byte)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.Length = 5
m_iLength = vData
End Property
Public Property Get Length() As Byte
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Length
Length = m_iLength
End Property
Public Property Let DataType(ByVal vData As DataTypeEnum)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.DataType = 5
m_iDataType = vData
End Property
Public Property Get DataType() As DataTypeEnum
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.DataType
DataType = m_iDataType
End Property
Public Property Let Caption(ByVal vData As String)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.Caption = 5
m_sCaption = vData
End Property
Public Property Get Caption() As String
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Caption
Caption = m_sCaption
End Property
Public Property Let Name(ByVal vData As String)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.Name = 5
m_sName = vData
End Property
Public Property Get Name() As String
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Name
Name = m_sName
End Property
Public Property Get ID() As Long
ID = m_iID
End Property
Public Property Let ID(ByVal vData As Long)
m_iID = vData
End Property
Public Property Get EntityID() As Long
EntityID = m_iEntityID
End Property
Public Property Let EntityID(ByVal vData As Long)
m_iEntityID = vData
End Property
Public Property Get FieldOption() As FieldOptionEnum
FieldOption = m_iFieldOption
End Property
Public Property Let FieldOption(ByVal vData As FieldOptionEnum)
m_iFieldOption = vData
End Property
Public Property Get HelpContextID() As String
HelpContextID = m_sHelpContextID
End Property
Public Property Let HelpContextID(ByVal vData As String)
m_sHelpContextID = vData
End Property
Public Property Get IsUsed() As Boolean
IsUsed = m_bIsUsed
End Property
Public Property Let IsUsed(ByVal vData As Boolean)
m_bIsUsed = vData
End Property
Public Property Get TaskID() As String
TaskID = m_sTaskID
End Property
Public Property Let TaskID(ByVal vData As String)
m_sTaskID = vData
End Property
Public Property Get EditProp() As EditPropertyEnum
EditProp = m_iEditProp
End Property
Public Property Let EditProp(ByVal vData As EditPropertyEnum)
m_iEditProp = vData
End Property
Public Property Get Decimals() As Byte
Decimals = m_iDecimals
End Property
Public Property Let Decimals(ByVal vData As Byte)
m_iDecimals = vData
End Property
Public Property Get Row() As Long
Row = m_iRow
End Property
Public Property Let Row(ByVal vData As Long)
m_iRow = vData
End Property
Public Property Get StartCol() As Long
StartCol = m_iStartCol
End Property
Public Property Let StartCol(ByVal vData As Long)
m_iStartCol = vData
End Property
Public Property Get EndCol() As Long
EndCol = m_iEndCol
End Property
Public Property Let EndCol(ByVal vData As Long)
m_iEndCol = vData
End Property
Public Property Get InputCol() As Long
InputCol = m_iInputCol
End Property
Public Property Let InputCol(ByVal vData As Long)
m_iInputCol = vData
End Property
Public Property Get RefFldSqc() As Long
RefFldSqc = m_iRefFldSqc
End Property
Public Property Let RefFldSqc(ByVal vData As Long)
m_iRefFldSqc = vData
End Property
Public Property Get Max() As Variant
Max = m_iMax
End Property
Public Property Let Max(ByVal vData As Variant)
m_iMax = vData
End Property
Public Property Get Min() As Variant
Min = m_iMin
End Property
Public Property Let Min(ByVal vData As Variant)
m_iMin = vData
End Property
Public Function Clone(Optional Mode As CloneModeEnum = 0) As FieldObject
Dim oFO As New FieldObject
With oFO
.AllowNull = Me.AllowNull
.TaskID = Me.TaskID
.Caption = Me.Caption
.DataType = Me.DataType
.DefaultValue = Me.DefaultValue
.Decimals = Me.Decimals
.EditProp = Me.EditProp
.EndCol = Me.EndCol
.EntityID = Me.EntityID
.FieldOption = Me.FieldOption
.HelpContextID = Me.HelpContextID
.ID = Me.ID
.InputCol = Me.InputCol
.IsUsed = Me.IsUsed
.Max = Me.Max
.Min = Me.Min
.Name = Me.Name
Set .Parent = Me.Parent
.Persistent = Me.Persistent
.QryFldSqc = Me.QryFldSqc
.RefFldSqc = Me.RefFldSqc
.ReferenceType = Me.ReferenceType
.Row = Me.Row
.Length = Me.Length
.SourceField = Me.SourceField
.StartCol = Me.StartCol
.Left = Me.Left
.Width = Me.Width
.InputLeft = Me.InputLeft
.InputWidth = Me.InputWidth
.Top = Me.Top
.Height = Me.Height
If Mode = esoStructureOnly Then
'----設置值為默認值,其余與原來的域對象完全一致
.Value = Me.DefaultValue
Else
.Value = Me.Value
End If
End With
Set Clone = oFO
End Function
Public Property Get QryFldSqc() As Long
QryFldSqc = m_iQryFldSqc
End Property
Public Property Let QryFldSqc(ByVal vData As Long)
m_iQryFldSqc = vData
End Property
Public Property Get Left() As Double
Left = m_dblLeft
End Property
Public Property Let Left(ByVal vData As Double)
m_dblLeft = vData
End Property
Public Property Get Width() As Double
Width = m_dblWidth
End Property
Public Property Let Width(ByVal vData As Double)
m_dblWidth = vData
End Property
Public Property Get InputLeft() As Double
InputLeft = m_dblInputLeft
End Property
Public Property Let InputLeft(ByVal vData As Double)
m_dblInputLeft = vData
End Property
Public Property Get InputWidth() As Double
InputWidth = m_dblInputWidth
End Property
Public Property Let InputWidth(ByVal vData As Double)
m_dblInputWidth = vData
End Property
Public Property Get Top() As Double
Top = m_dblTop
End Property
Public Property Let Top(ByVal vData As Double)
m_dblTop = vData
End Property
Public Property Get Height() As Double
Height = m_dblHeight
End Property
Public Property Let Height(ByVal vData As Double)
m_dblHeight = vData
End Property
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -