0
我的代碼調用WebMethod。在該WebMethod中,我需要創建一個新的控件集合。在VB中我通常會寫:從WebMethod內使用CreateControlCollection()
Dim cc As System.Web.UI.ControlCollection = CreateControlCollection()
但因爲我是一個WebMethod裏面,我得到的錯誤:
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
任何建議嗎? 謝謝大家!
感謝您的回覆,但是 - 我明白錯誤信息的含義。 問題是,在一個web方法中 - 你不能使用[new]命令 - 它返回 Dim cc As New System.Web.UI.ControlCollection 重載解析失敗,因爲沒有可訪問的'NEW'接受這個數量的參數' – wotney