Retrieve the error string that corresponds the value of the
Code property.
Syntax
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 Basic | Copy Code |
---|
Private Sub GetSetBarcodeExceptionCodeMessageTest()
Dim code As BarcodeExceptionCode = BarcodeExceptionCode.InvalidType
Dim message As String = BarcodeException.GetCodeMessage(code)
MessageBox.Show(String.Format("Code: {0}, message: {1}", code, message))
Try
Throw New BarcodeException(code)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
BarcodeException.SetCodeMessage(code, "My new message")
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
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