Leadtools.Barcode Requires Barcode add-on license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
GetCodeMessage Method
See Also  Example
Leadtools.Barcode Namespace > BarcodeException Class : GetCodeMessage Method



code
Flag that indicates the exception code for which to retrieve its message string.
code
Flag that indicates the exception code for which to retrieve its message string.
Retrieves the error string that corresponds the value of the Code property.

Syntax

Visual Basic (Declaration) 
Public Shared Function GetCodeMessage( _
   ByVal code As BarcodeExceptionCode _
) As String
Visual Basic (Usage)Copy Code
Dim code As BarcodeExceptionCode
Dim value As String
 
value = BarcodeException.GetCodeMessage(code)
C# 
public static string GetCodeMessage( 
   BarcodeExceptionCode code
)
C++/CLI 
public:
static String^ GetCodeMessage( 
   BarcodeExceptionCode code
) 

Parameters

code
Flag that indicates the exception code for which to retrieve its message string.

Return Value

A character string to be updated with the current message for code.

Example

Visual BasicCopy Code
Private Sub GetSetBarcodeExceptionCodeMessageTest()
   ' Get the initial FileFormat message
   Dim code As BarcodeExceptionCode = BarcodeExceptionCode.InvalidType
   Dim message As String = BarcodeException.GetCodeMessage(code)
   MessageBox.Show(String.Format("Code: {0}, message: {1}", code, message))

   ' make sure that this message is used now
   Try
      Throw New BarcodeException(code)
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try

   ' change this message to a custom one
   BarcodeException.SetCodeMessage(code, "My new message")

   ' make sure that this new message is used now
   Try
      Throw New BarcodeException(code)
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try
End Sub
C#Copy Code
private void GetSetBarcodeExceptionCodeMessageTest() 

   // Get the initial FileFormat message 
   BarcodeExceptionCode code = BarcodeExceptionCode.InvalidType; 
   string message = BarcodeException.GetCodeMessage(code); 
   MessageBox.Show(string.Format("Code: {0}, message: {1}", code, message)); 
 
   // make sure that this message is used now 
   try 
   { 
      throw new BarcodeException(code); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
 
   // change this message to a custom one 
   BarcodeException.SetCodeMessage(code, "My new message"); 
 
   // make sure that this new message is used now 
   try 
   { 
      throw new BarcodeException(code); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
}

Remarks

By default, BarcodeException has a string message for each flag of the BarcodeExceptionCode. To change the error string that corresponds to the Code property value, call the SetCodeMessage method.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Barcode requires a Barcode Module license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features