【发布时间】:2012-02-28 06:06:01
【问题描述】:
我了解到,在 VB6 中,用户定义的类不能指定构造函数。因此,给定一个名为实体的 Collection 对象,在主代码块中标注尺寸和一个名为 Entity 的用户定义类:
Public Class Entry
'local variable(s) to hold property value(s)
Private mvarcurrNameValue As String 'local copy
Private mvarnewwNameValue As String 'local copy
Public Property Let newwNameValue(ByVal vData As String)
mvarnewwNameValue = vData
End Property
Public Property Get newwNameValue() As String
newwNameValue = mvarnewwNameValue
End Property
Public Property Let currNameValue(ByVal vData As String)
mvarcurrNameValue = vData
End Property
Public Property Get currNameValue() As String
currNameValue = mvarcurrNameValue
End Property
End Class
如何在 VB6 领域实现以下 C++/VB.NET 习语?
For Each foo In bar
entities.Add (new Entity("Sinatra","Frank")) 'VB.NET seems to like this but not VB6
Next
我事先不知道会有多少个Entity实例。
TIA,
还在学习的史蒂夫
【问题讨论】:
标签: collections vb6