Retrieves the error string that corresponds the value of the
Code property.
Syntax
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 Basic | Copy 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);
}
} |
SilverlightCSharp | Copy 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);
}
} |
SilverlightVB | Copy 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
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