好学IT学院:IT信息技术分享交流平台
标签:VB  来源:互联网  作者:不详  发布时间:2009-05-19  ★★★加入收藏〗〖手机版
摘要:用VB代码实现方法引用:无,部件:无 设计:在Form1中右下角加入一个CommandButton,名称默认为Command1,窗体的AutoRedraw属性设为True窗体文件一:Form1Option ExplicitPrivate m……

类模块一:类名:cBomReturnValue

Option Explicit

'保持属性值的局部变量
Private mvarAssBom As String '局部复制
Private mvarBomPoint As String '局部复制
Private mvarQuantity As Double '局部复制
Private mvarExpression As String '局部复制
Public Property Let Expression(ByVal vData As String)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.Expression = 5
mvarExpression = vData
End Property

Public Property Get Expression() As String
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.Expression
Expression = mvarExpression
End Property

Public Property Let Quantity(ByVal vData As Double)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.Quantity = 5
mvarQuantity = vData
End Property

Public Property Get Quantity() As Double
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.Quantity
Quantity = mvarQuantity
End Property

Public Property Let BomPoint(ByVal vData As String)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.BomPoint = 5
mvarBomPoint = vData
End Property

Public Property Get BomPoint() As String
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.BomPoint
BomPoint = mvarBomPoint
End Property

Public Property Let AssBom(ByVal vData As String)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.AssBom = 5
mvarAssBom = vData
End Property

Public Property Get AssBom() As String
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.AssBom
AssBom = mvarAssBom
End Property

类模块二:类名:cBomValue

Option Explicit

'保持属性值的局部变量
Private mvarAssBom As String '局部复制
Private mvarBomPoint As String '局部复制
Private mvarQuantity As Double '局部复制
Public Property Let Quantity(ByVal vData As Double)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.Quantity = 5
mvarQuantity = vData
End Property

Public Property Get Quantity() As Double
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.Quantity
Quantity = mvarQuantity
End Property

Public Property Let BomPoint(ByVal vData As String)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.BomPoint = 5
mvarBomPoint = vData
End Property

Public Property Get BomPoint() As String
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.BomPoint
BomPoint = mvarBomPoint
End Property

Public Property Let AssBom(ByVal vData As String)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.AssBom = 5
mvarAssBom = vData
End Property


Public Property Get AssBom() As String
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.AssBom
AssBom = mvarAssBom
End Property

类模块三:类名:cPointValue

Option Explicit

'保持属性值的局部变量
Private mvarBomPoint As String '局部复制
Private mvarQuantity As Double '局部复制
Public Property Let Quantity(ByVal vData As Double)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.Quantity = 5
mvarQuantity = vData
End Property

Public Property Get Quantity() As Double
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.Quantity
Quantity = mvarQuantity
End Property

Public Property Let BomPoint(ByVal vData As String)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.BomPoint = 5
mvarBomPoint = vData
End Property

Public Property Get BomPoint() As String
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.BomPoint
BomPoint = mvarBomPoint
End Property

加入后可直接在窗体中Print出列表。