in

Archived Data Techniques Forums

InvalidCastException thrown when accessing Duplex property on Twain Control

Last post 03-28-2008 10:31 AM by tgrant. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-28-2008 10:31 AM

    • tgrant
    • Not Ranked
    • Joined on 03-28-2008
    • Posts 1

    InvalidCastException thrown when accessing Duplex property on Twain Control

    I am writing a method in C# that obtains every Identity object in the Sources property and then determines for each Identity whether it supports Duplex.  However, I am getting an InvalidCastException.  The scanner is a Fujitsu fi-5120C.  Can someone please help?  Thanks.

     _Twain is an instance of TwainControl.

    private bool DetermineIfDeviceSupportsDuplex(Identity idnt)

    {

         try

         {

               _Twain.CurrentSource = idnt;

              Duplexes duplex = _Twain.Duplex; // I get an InvalidCastException here

              if (duplex != Duplexes.None)

              {

                   return true;

              }

              else

              {

                   return false;

              }

         }

         finally

         {

              _Twain.CloseSource();

              _Twain.CurrentSource = null;

         }

         return false;

    }

Page 1 of 1 (1 items)
Copyright 2009 Data Techniques, Inc. All Rights Reserved.