This might sound like a stupid question, but I am about to pull hear out.
I have a Sub whereby I want to parse an array and assign it to a Class Module "Object".
How do I go about doing this.
What I do have that isn't working is:
Private matrix(9,9) As Integer
'The Setter Sub
Public Sub SetMatrixArray(arrValToSet() as Integer)
matrix = arrValToSet
End Sub
'In the caller module / class module I have the following code to parse the array.
Dim theArray(9,9) As Integer
Dim customObj as CustomObject
customObj.SetMatrixArray(theArray)
I get the following error message:
Type mismatch: array or user-defined type expected.
This works:
'In the caller module / class module I have the following code to parse the array.'
Dim theArray(9,9) As Integer
Dim customObj as CustomObject
customObj.SetMatrixArray theArray
'The Class'
Private matrix() As Integer
'The Setter Sub '
Public Sub SetMatrixArray(arrValToSet() as Integer)
matrix = arrValToSet
End Sub
So remove the dimensioning of the matrix array in your class. You can always implement errorchecking if the dimensions must be exactly 9.
EDIT: I removed the parens around the procedure calling without thinking while testing, it may influence the answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With