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




code
flag that indicates the exception code to retrieve its message string.
Retrieve 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
)
Managed Extensions for C++ 
public: static string* GetCodeMessage( 
   BarcodeExceptionCode code
) 
C++/CLI 
public:
static String^ GetCodeMessage( 
   BarcodeExceptionCode code
) 

Parameters

code
flag that indicates the exception code 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: Raster Pro/Document/Medical Features