_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
    必需。“帮助”关键字。

备注

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 命名空间