Sets the error string that corresponds to a specific
WiaExceptionCode.
Syntax
Parameters
- code
- A WiaExceptionCode value for which
the error string is being set.
- message
- A String that contains the new
message for code.
Example
Visual Basic | Copy Code |
---|
<Test> _
Public Sub SetCodeMessageExample()
Dim code As WiaExceptionCode = WiaExceptionCode.PaperEmpty
Dim message As String = WiaException.GetCodeMessage(code)
MessageBox.Show(String.Format("Code: {0}, message: {1}", code, message))
Try
Throw New WiaException(code)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
WiaException.SetCodeMessage(code, "My new message")
Try
Throw New WiaException(code)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub |
C# | Copy Code |
---|
public void SetCodeMessageExample() { // Get the initial FileFormat message WiaExceptionCode code = WiaExceptionCode.PaperEmpty; string message = WiaException.GetCodeMessage(code); MessageBox.Show(string.Format("Code: {0}, message: {1}", code, message)); // make sure that this message is used now try { throw new WiaException(code); } catch(Exception ex) { MessageBox.Show(ex.Message); } // change this message to a custom one WiaException.SetCodeMessage(code, "My new message"); // make sure that this new message is used now try { throw new WiaException(code); } catch(Exception ex) { MessageBox.Show(ex.Message); } } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows 2000, Windows XP, Windows Vista, Windows Server 2003 family, Windows Server 2008 family
See Also