LEADTOOLS Barcode (Leadtools.Barcode assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
GetCodeMessage Method
See Also 
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
Public Sub GetSetBarcodeExceptionCodeMessageTest()
   ' Get the initial FileFormat message
   Dim code As BarcodeExceptionCode = BarcodeExceptionCode.InvalidType
   Dim message As String = BarcodeException.GetCodeMessage(code)
   Console.WriteLine("Code: {0}, message: {1}", code, message)

   ' make sure that this message is used now
   Try
      Throw New BarcodeException(code)
   Catch ex As Exception
      Console.WriteLine(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
      Console.WriteLine(ex.Message)
   End Try
End Sub
C#Copy Code
public void GetSetBarcodeExceptionCodeMessageTest()
{
   // Get the initial FileFormat message
   BarcodeExceptionCode code = BarcodeExceptionCode.InvalidType;
   string message = BarcodeException.GetCodeMessage(code);
   Console.WriteLine("Code: {0}, message: {1}", code, message);

   // make sure that this message is used now
   try
   {
      throw new BarcodeException(code);
   }
   catch (Exception ex)
   {
      Console.WriteLine(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)
   {
      Console.WriteLine(ex.Message);
   }
}
SilverlightCSharpCopy Code
public void GetSetBarcodeExceptionCodeMessageTest(RasterImage image)
{
   // Get the initial FileFormat message
   BarcodeExceptionCode code = BarcodeExceptionCode.InvalidType;
   string message = BarcodeException.GetCodeMessage(code);
   Console.WriteLine("Code: {0}, message: {1}", code, message);
   // make sure that this message is used now
   try
   {
      throw new BarcodeException(code);
   }
   catch (Exception ex)
   {
      Console.WriteLine(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)
   {
      Console.WriteLine(ex.Message);
   }
}
SilverlightVBCopy Code
Public Sub GetSetBarcodeExceptionCodeMessageTest(ByVal image As RasterImage)
  ' Get the initial FileFormat message
  Dim code As BarcodeExceptionCode = BarcodeExceptionCode.InvalidType
  Dim message As String = BarcodeException.GetCodeMessage(code)
  Console.WriteLine("Code: {0}, message: {1}", code, message)
  ' make sure that this message is used now
  Try
    Throw New BarcodeException(code)
  Catch ex As Exception
    Console.WriteLine(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
    Console.WriteLine(ex.Message)
  End Try
End Sub

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 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

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