自定义属性中怎么实现动态数组
jsstb 2009-03-14 04:24:23 在自定义DLL中定义属性InData代码如下:
Public Structure typDt
Dim userdt1 As Long
Dim userdt2 As Long
End Structure
Public Structure typData
Dim lngTCode As Long
Dim lngAll As Long
Dim UserData() As typdt
End Structure
Public Property InData() As typData
Get
Return InDt
End Get
Set(ByVal value As typData)
InDt = value
End Set
End Property
其中属性InData为一结构变量,其中成员UserData()是一个动态数组,即在使用DLL时才能决定数组长度,由DLL的另外一个属性来设置。应该怎么写代码?
我用ReDim重新分配数组,应该写在哪里?是写在DLL里,还是使用DLL时,写在工程里?