共用方式為


_dispVCProjectEngineEvents.ReportError(String, Int32, String) Method

Definition

Sends an error message to the user interface.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 void ReportError(System::String ^ ErrMsg, int errCode, System::String ^ HelpKeyword);
public:
 void ReportError(Platform::String ^ ErrMsg, int errCode, Platform::String ^ HelpKeyword);
void ReportError(std::wstring const & ErrMsg, int errCode, std::wstring const & HelpKeyword);
[System.Runtime.InteropServices.DispId(281)]
public void ReportError (string ErrMsg, int errCode, string HelpKeyword);
[<System.Runtime.InteropServices.DispId(281)>]
abstract member ReportError : string * int * string -> unit
Public Sub ReportError (ErrMsg As String, errCode As Integer, HelpKeyword As String)

Parameters

ErrMsg
String

Required. The error msg.

errCode
Int32

Required. The error code.

HelpKeyword
String

Required. The help keyword.

Attributes

Examples

[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  

Remarks

The ReportError method advises the Visual Studio integrated development environment (IDE) that it must handle an error.

Applies to