01-03-2009, 06:01 PM
I maneged to make a working version, but I don't know exactly how to get the value with direct access to the variable. Well, try for your self:
And the Form1 example:
EDIT:
Now it works, but since you can't overload in vb6, you cant use the same name for both functions.
Code:
Option Explicit
Private account_Buffer() As Byte
Private Sub Class_Initialize()
ReDim account_Buffer(1 To 10) As Byte
Dim i As Long
For i = 1 To 10
account_Buffer(i) = i
Next i
End Sub
Public Property Get Buffer() As Byte()
Buffer = account_Buffer
End Property
Public Property Get Item(ByVal index As Integer) As Byte
Buffer = account_Buffer(index)
End Property
Public Property Let Item(ByVal index As Integer, ByVal value As Byte)
account_Buffer(index) = value
End Property
Public Property Let Buffer(ByRef vData() As Byte)
account_Buffer = vData
End Property
Code:
Private Sub Form_Load()
Dim vari As Class1
Set vari = New Class1
Dim haha() As Byte
vari.Item(1) = 2
haha = vari.Buffer
Dim i As Long
For i = 1 To 10
MsgBox haha(i)
Next i
End Sub
EDIT:
Now it works, but since you can't overload in vb6, you cant use the same name for both functions.