.

ConfigLoadPropertyErrorEventArgs.ErrorCode

This is the type of error that occurred.

Version History

Introduced in MPX 2.0.

Type

ConfigLoadErrorCode (read only)

Visual Basic

Syntax

ReadOnly Property ErrorCode() As ConfigLoadErrorCode

Sample Code

 

' This method handles PropertyError events that occur while

' loading the configuration of an object.

Public Sub OnLoadPropertyError(ByVal loader As Mpx.ConfigLoader,

ByVal e As Mpx.ConfigLoadPropertyErrorEventArgs)

   Dim msg As String = "Warning: "

 

   Select Case e.ErrorCode

      Case Mpx.ConfigLoadErrorCode.Missing

         If e.PropertyPath.StartsWith("Controller.Can") Then

            ' Ignore missing Can and CanNode objects

            Return

         End If

      Case Mpx.ConfigLoadErrorCode.Unsupported

      Case Else

         ' For all other errors, print an error message and

         ' cancel the load.

         msg = "Error: "

 

         ' Cancel the load operation

         loader.Cancel()

   End Select

 

End Sub

 


Sample Application

 

C#

Syntax

ConfigLoadErrorCode ErrorCode { get; }

Sample Code

 

// This method handles PropertyError events that occur while loading
// configuration to an object.

public void OnLoadPropertyError(Mpx.ConfigLoader loader,
   Mpx.ConfigLoadPropertyErrorEventArgs e)
{

   if (e.ErrorCode != Mpx.ConfigLoadErrorCode.Missing)
   {
      // Cancel the save operation
      loader.Cancel();

      // Print an error message
      string msg = "Error: ";
      msg += e.PropertyPath
         + ": "
         + e.Message
         + "\n";
      System.Console.Write(msg);
   }
}

See Also

ConfigLoadPropertyErrorEventArgs

ConfigLoadErrorCode

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2021 Motion Engineering