Sets the error string that corresponds to a specific TwainExceptionCode
public static void SetCodeMessage(TwainExceptionCode code,string message)
Public Shared Sub SetCodeMessage( _ByVal code As Leadtools.Twain.TwainExceptionCode, _ByVal message As String _)
public:static void SetCodeMessage(Leadtools.Twain.TwainExceptionCode code,String^ message)
code
A TwainExceptionCode value to set the string message for.
message
A String that contains the new message for code.
By default, TwainException has a string message for each TwainExceptionCode. You can get this message by using the GetCodeMessage method. Also, you can change any string message for any TwainExceptionCode by using the SetCodeMessage method.
using Leadtools;using Leadtools.Twain;public void SetCodeMessageExample(){// Get the initial FileFormat messageTwainExceptionCode code = TwainExceptionCode.StopScan;string message = TwainException.GetCodeMessage(code);MessageBox.Show(string.Format("Code: {0}, message: {1}", code, message));// make sure that this message is used nowtry{throw new TwainException(code);}catch (Exception ex){MessageBox.Show(ex.Message);}// change this message to a custom oneTwainException.SetCodeMessage(code, "My new message");// make sure that this new message is used nowtry{throw new TwainException(code);}catch (Exception ex){MessageBox.Show(ex.Message);}}
Imports LeadtoolsImports Leadtools.TwainPublic Sub SetCodeMessageExample()' Get the initial FileFormat messageDim code As TwainExceptionCode = TwainExceptionCode.StopScanDim message As String = TwainException.GetCodeMessage(code)MessageBox.Show(String.Format("Code: {0}, message: {1}", code, message))' make sure that this message is used nowTryThrow New TwainException(code)Catch ex As ExceptionMessageBox.Show(ex.Message)End Try' change this message to a custom oneTwainException.SetCodeMessage(code, "My new message")' make sure that this new message is used nowTryThrow New TwainException(code)Catch ex As ExceptionMessageBox.Show(ex.Message)End TryEnd Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
