共用方式為


RegistrationErrorInfo.ErrorString 屬性

定義

取得 ErrorCode 的描述。

public:
 property System::String ^ ErrorString { System::String ^ get(); };
public string ErrorString { get; }
member this.ErrorString : string
Public ReadOnly Property ErrorString As String

屬性值

ErrorCode 的描述。

範例

下列程式代碼範例示範如何從 RegistrationErrorInfo 物件擷取錯誤字串。

// Check whether the ErrorInfo property of the RegistrationException object is null. 
// If there is no extended error information about 
// methods related to multiple COM+ objects ErrorInfo will be null.
if ( e->ErrorInfo != nullptr )
{
   // Gets an array of RegistrationErrorInfo objects describing registration errors
   array<RegistrationErrorInfo^>^ registrationErrorInfos = e->ErrorInfo;
   
   // Iterate through the array of RegistrationErrorInfo objects and disply the 
   // ErrorString for each object.
   System::Collections::IEnumerator^ myEnum = registrationErrorInfos->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      RegistrationErrorInfo^ registrationErrorInfo = (RegistrationErrorInfo^)( myEnum->Current );
      Console::WriteLine( registrationErrorInfo->ErrorString );
   }
}
// Check whether the ErrorInfo property of the RegistrationException object is null.
// If there is no extended error information about
// methods related to multiple COM+ objects ErrorInfo will be null.
if(e.ErrorInfo != null)
{
    // Gets an array of RegistrationErrorInfo objects describing registration errors
    RegistrationErrorInfo[] registrationErrorInfos = e.ErrorInfo;

    // Iterate through the array of RegistrationErrorInfo objects and disply the
    // ErrorString for each object.

    foreach (RegistrationErrorInfo registrationErrorInfo in registrationErrorInfos)
    {
        Console.WriteLine(registrationErrorInfo.ErrorString);
    }
}
' Check whether the ErrorInfo property of the RegistrationException object is null. 
' If there is no extended error information about 
' methods related to multiple COM+ objects ErrorInfo will be null.
If Not (e.ErrorInfo Is Nothing) Then
    ' Gets an array of RegistrationErrorInfo objects describing registration errors
    Dim registrationErrorInfos As RegistrationErrorInfo() = e.ErrorInfo

    ' Iterate through the array of RegistrationErrorInfo objects and disply the 
    ' ErrorString for each object.
    Dim registrationErrorInfo As RegistrationErrorInfo
    For Each registrationErrorInfo In registrationErrorInfos
        MsgBox(registrationErrorInfo.ErrorString)
    Next registrationErrorInfo
End If

適用於