Leadtools.Wia Namespace > WiaException Class : SetCodeMessage Method |
public static void SetCodeMessage( WiaExceptionCode code, string message )
'Declaration Public Shared Sub SetCodeMessage( _ ByVal code As WiaExceptionCode, _ ByVal message As String _ )
'Usage Dim code As WiaExceptionCode Dim message As String WiaException.SetCodeMessage(code, message)
public static void SetCodeMessage( WiaExceptionCode code, string message )
public: static void SetCodeMessage( WiaExceptionCode code, String^ message )
<Test> _ Public Sub SetCodeMessageExample() ' Get the initial FileFormat message Dim code As WiaExceptionCode = WiaExceptionCode.PaperEmpty Dim message As String = 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 ex As Exception MessageBox.Show(ex.Message) End Try ' 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 ex As Exception MessageBox.Show(ex.Message) End Try End Sub
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); } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2