0
我在VB寫的宏爲Visual Studio:參考非共享成員需要的對象引用
Imports EnvDTE
Imports EnvDTE80
Imports Microsoft.VisualBasic
Public Class C
Implements VisualCommanderExt.ICommand
Sub Run(DTE As EnvDTE80.DTE2, package As Microsoft.VisualStudio.Shell.Package) Implements VisualCommanderExt.ICommand.Run
FileNamesExample()
End Sub
Sub FileNamesExample()
Dim proj As Project
Dim projitems As ProjectItems
' Reference the current solution and its projects and project items.
proj = DTE.ActiveSolutionProjects(0)
projitems = proj.ProjectItems
' List the file name associated with the first project item.
MsgBox(projitems.Item(1).FileNames(1))
End Sub
End Class
我編譯之後得到這個:
錯誤(17,0):錯誤BC30469:對非共享成員的引用需要對象引用。
你有什麼想法是什麼錯?我之前沒有在VB中開發,我只需要即時幫助。