InterviewSolution
| 1. |
Solve : Visual Basic PAssing Arrays to Classes? |
|
Answer» Hello, Hello, when you assign an array, you have to assign an array. You aren't assigning an array- you are passing element 24 of the mStrNameArray (a string, I imagine) to the NameArray() property procedure. In this case, what the property procedure is receiving is two parameters- an array (I assume strNameArray exists). The only argument your property procedure accepts is the LEFT hand side (the value being assigned). What you are doing with something like: Code: [Select]class.arrayproperty(12)=value is not valid; since your "arrayproperty" property doesn't accept any arguments other then the left hand side. The way you would assign an array is as a whole: class.arrayproperty=arrayvariable Or, in your case, you can add an argument to your property procedure (I think, I'm not as familiar with .NET as with VB6, but I imagine if VB6 let's you VB.NET does): [code] Public WriteOnly Property NameArray(ByVal strNameArray() As Object) As String Set(ByVal vIndex as Integer, ByVal value As String) strNameArray(vindex) = vdata End Set End Property [/code] |
|