共用方式為


_dispVCProjectEngineEvents.ReportError 方法

這個 API 支援 .NET Framework 基礎結構,但您不可以直接在程式碼中使用它。

傳送錯誤訊息至使用者介面。

命名空間:  Microsoft.VisualStudio.VCProjectEngine
組件:  Microsoft.VisualStudio.VCProjectEngine (在 Microsoft.VisualStudio.VCProjectEngine.dll 中)

語法

'宣告
Sub ReportError ( _
    ErrMsg As String, _
    errCode As Integer, _
    HelpKeyword As String _
)
void ReportError(
    string ErrMsg,
    int errCode,
    string HelpKeyword
)
void ReportError(
    [InAttribute] String^ ErrMsg, 
    [InAttribute] int errCode, 
    [InAttribute] String^ HelpKeyword
)
abstract ReportError : 
        ErrMsg:string * 
        errCode:int * 
        HelpKeyword:string -> unit 
function ReportError(
    ErrMsg : String, 
    errCode : int, 
    HelpKeyword : String
)

參數

  • HelpKeyword
    型別:System.String
    必要項。Help 關鍵字。

備註

ReportError 方法通知 Visual Studio 整合式開發環境 (IDE) 它必須處理錯誤。

範例

[Visual Basic]

' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
     Sub ReportError(ByVal ErrMsg As String, ByVal ErrCode As Integer, _
                     ByVal HelpKeyword As String)
        MsgBox(ErrMsg)
    End Sub

    Sub Main()
        Dim projEngine As VCProjectEngine
        Dim evt As VCProjectEngineEvents
        Dim prj As VCProject
        Dim col As IVCCollection
        Dim folder1, folder2 As VCFilter
        prj = DTE.Solution.Projects.Item(1).Object
        projEngine = prj.VCProjectEngine
        evt = projEngine.Events
        AddHandler evt.ReportError, AddressOf ReportError
        col = prj.Filters
        folder1 = col.Item(1)
        folder2 = col.Item(2)
        folder1.Name = folder2.Name
    End Sub
End Module

.NET Framework 安全性

請參閱

參考

_dispVCProjectEngineEvents 介面

Microsoft.VisualStudio.VCProjectEngine 命名空間