2010-10-28 51 views
2

當我嘗試構建我的解決方案時出現奇怪的錯誤。當我調用oGetHeaderValue函數並傳遞參數時發生此錯誤。類'clsGetHeaderValue'不能被索引,因爲它沒有默認屬性

Dim oGetHeaderValue As New clsGetHeaderValue 

Dim returnString As String 
returnString = oGetHeaderValue(strInvoiceNumber, strOrderNumber) 

錯誤消息是:類'clsGetHeaderValue'不能被索引,因爲它沒有默認屬性。

回答

6

你打電話給你的實例oGetHeaderValue就好像它是一種方法。它看起來像你可能打算調用它的功能,但錯過了那一點。 因此,也許你的代碼應該是:

Dim returnString As String = oGetHeaderValue.YourMethod(strInvoiceNumber, strOrderNumber) 

哪裏YourMethod是你想叫什麼方法。

而只是爲了重新閱讀你的問題澄清後,oGetHeaderValue不是一個函數,它可能包含的功能和潛艇等

+0

doh !!!非常感謝。 – user279521 2010-10-28 14:13:34

1

的混亂是由這樣的事實引起的類的實例VB.Net用途()用於數組索引以及方法調用。

相關問題