Added: Apr 29, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
The trick to this tip is to remember that a variant can hold any type of data, including an array. Just define the property as a variant and use it as an array. The following code is in a class called CArray
Highlight all by clicking in box
Private m_MyArray As Variant
Public Property Get MyArray() As Variant
MyArray = m_MyArray
Public Property Let MyArray(a As Variant)
m_MyArray = a
'You can then use these properties in several different ways, as 'illustrated by the following code from a form
Private m_Array As CArray
Private mArr(3) As String
Private Sub Form_Load()
Set m_Array = New CArray
mArr(1) = "One"
mArr(2) = "Two"
mArr(3) = "Three"
m_Array.MyArray = mArr()
'm_Array.MyArray = Array("One", "Two", "Three")
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
For i = 1 To UBound(m_Array.MyArray)
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.