|
-
Sep 10th, 2001, 10:20 AM
#1
you could make the property a variant, they can hold string arrays.
-
Sep 10th, 2001, 10:22 AM
#2
You can create a public property in the form itself.
VB Code:
Option Explicit
Private m_arrMyProperty As Variant
Public Property Get MyProperty() As Variant
MyProperty = m_arrMyProperty
End Property
Public Property Let MyProperty(ByVal p_arrNewValue As Variant)
m_arrMyProperty = p_arrNewValue
End Property
Private Sub Command1_Click()
Dim arr(1) As String
arr(0) = "AAA"
arr(1) = "BBB"
MyProperty = arr
End Sub
-
Sep 10th, 2001, 11:07 AM
#3
Fanatic Member
Code...
Alternatively, instead of using nasty variants  , just return a dynamic string array...i.e.
VB Code:
'Coded by [Digital-X-Treme]...
'In a class, called CStringObj.cls
Option Explicit
Private m_strAr() As String
Private Sub Class_Initialize()
Dim i As Integer
ReDim m_strAr(10)
For i = 0 To 10
m_strAr(i) = i
Next i
End Sub
Public Property Get My_String_Array() As String()
My_String_Array = m_strAr()
End Property
'In a form...
Option Explicit
Private Sub Form_Load()
Dim i As Integer
Dim x As New CStringObj
Dim mStrAr() As String
mStrAr() = x.My_String_Array
For i = 0 To UBound(mStrAr())
Debug.Print mStrAr(i)
Next i
End Sub
Hope this helps 
Laterz
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Sep 10th, 2001, 11:13 AM
#4
Fanatic Member
Info...
Apologies, that code only included a property Get... Here's the complete code.
VB Code:
'Coded by [Digital-X-Treme]...
'In a class, called CStringObj.cls
Option Explicit
Private m_strAr() As String
Private Sub Class_Initialize()
Dim i As Integer
ReDim m_strAr(10)
For i = 0 To 10
m_strAr(i) = i
Next i
End Sub
Public Property Get MY_String_Array() As String()
MY_String_Array = m_strAr()
End Property
'As we have to pass ByRef, copy the argument, element by element, into the private array.
Public Property Let MY_String_Array(ByRef strAr() As String)
Dim i As Integer
ReDim m_strAr(UBound(strAr()))
For i = 0 To UBound(strAr())
m_strAr(i) = strAr(i)
Next i
End Property
'In a form...
Option Explicit
Private Sub Form_Load()
Dim i As Integer
Dim x As New CStringObj
Dim mStrAr() As String
mStrAr() = x.MY_String_Array
For i = 0 To UBound(mStrAr())
Debug.Print mStrAr(i)
Next i
mStrAr(5) = 0
x.MY_String_Array = mStrAr
For i = 0 To UBound(mStrAr())
Debug.Print mStrAr(i)
Next i
End Sub
Hope this helps 
Laterz
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|