←Select platform

GetCodeMessage Method

Summary
Gets the error string that corresponds to the specified WiaExceptionCode.

Syntax
C#
C++/CLI
Python
public static string GetCodeMessage( 
   WiaExceptionCode code 
) 
public: 
static String^ GetCodeMessage(  
   WiaExceptionCode code 
)  
def GetCodeMessage(self,code): 

Parameters

code
A WiaExceptionCode value for which the corresponding error string is being sought.

Return Value

A System.String that contains the current message for code.

Remarks

By default, WiaException has a string message for each WiaExceptionCode. You can get this message by calling this method. Moreover, you can change any string message for any WiaExceptionCode by using the SetCodeMessage method.

Example
C#
using Leadtools; 
using Leadtools.Wia; 
 
public void SetCodeMessageExample() 
{ 
   // Get the initial FileFormat message 
   WiaExceptionCode code = WiaExceptionCode.PaperEmpty; 
   string message = WiaException.GetCodeMessage(code); 
   Console.WriteLine(string.Format("Code: {0}, message: {1}", code, message)); 
 
   // make sure that this message is used now 
   try 
   { 
      throw new WiaException(code); 
   } 
   catch (Exception ex) 
   { 
      Console.WriteLine(ex.Message); 
   } 
 
   // change this message to a custom one 
   WiaException.SetCodeMessage(code, "My new message"); 
 
   // make sure that this new message is used now 
   try 
   { 
      throw new WiaException(code); 
   } 
   catch (Exception ex) 
   { 
      Console.WriteLine(ex.Message); 
   } 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Wia Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.