這聽起來像一個愚蠢的問題,但我對拉聽得出來。的Visual Basic 6陣列作爲參數
我有一個Sub由此我想分析陣列並將其分配給一個類模塊「對象」。
我如何去這樣做。
我確實有不工作是:
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)
我收到以下錯誤信息:
類型不匹配:數組或用戶定義類型預期。
Dabblernl的答案應該有效。如果你有更多的問題,[this](http://www.cpearson.com/excel/passingandreturningarrays.htm)似乎是相當不錯的一種數組資源(它是關於VBA的,但是這足夠接近於有用)。 – 2011-05-18 20:29:54
@ ho1我並不反對,但他調用SetMatrixArray的語法不正確。我正在查看[this](http://msdn.microsoft.com/en-us/library/wcx04ck5(VS.85).aspx)。我錯了嗎? – 2011-05-18 20:38:38
@Jay:不,我認爲你完全正確。我太習慣VB.Net,所以直到現在我才注意到那些額外的括號。我認爲你需要結合你和Dabblernl的答案。 – 2011-05-18 20:51:55