VintaSoft Twain .NET SDK v10.2
Vintasoft.Twain Namespace / DeviceCapability Class / SetValue Method / SetValue(Boolean) Method
New current value of device capability.
Example




In This Topic
    SetValue(Boolean) Method
    In This Topic
    Sets the current value of device capability.
    Syntax
    'Declaration
     
    Public Overloads Sub SetValue( _
       ByVal value As Boolean _
    ) 
    'Usage
     
    Dim instance As DeviceCapability
    Dim value As Boolean
     
    instance.SetValue(value)
    public void SetValue( 
       bool value
    )
    public: void SetValue( 
       bool value
    ) 
    public:
    void SetValue( 
       bool value
    ) 

    Parameters

    value
    New current value of device capability.
    Exceptions
    ExceptionDescription
    Thrown if device is in wrong state.
    Thrown if error occurs during setting value of capability.
    Thrown if the .NET debugger is used and the function evaluation requires all threads to run.
    Example
    This example shows how to enable duplex using capability of device. Thrown if the .NET debugger is used and the function evaluation requires all threads to run.
    Private Shared Sub SetDuplexEnabledCapValue()
        Using deviceManager1 As New DeviceManager()
            ' open the device manager
            deviceManager1.Open()
                
            ' get reference to the default device
            Dim device As Device = deviceManager1.DefaultDevice
                
            ' open the device
            device.Open()
                
            ' get reference to object that manipulates DuplexEnabled capability
            Dim duplexEnabledCap As DeviceCapability = device.Capabilities.Find(DeviceCapabilityId.DuplexEnabled)
            ' if DuplexEnabled capability supported
            If duplexEnabledCap IsNot Nothing Then
                ' set value of DuplexEnabled capability
                duplexEnabledCap.SetValue(True)
            End If
                
            ' close the device
            device.Close()
                
            ' close the device manager
            deviceManager1.Close()
        End Using
    End Sub
    private static void SetDuplexEnabledCapValue()
    {
        using (DeviceManager deviceManager1 = new DeviceManager())
        {
            // open the device manager
            deviceManager1.Open();
                
            // get reference to the default device
            Device device = deviceManager1.DefaultDevice;
                
            // open the device
            device.Open();
                
            // get reference to object that manipulates DuplexEnabled capability
            DeviceCapability duplexEnabledCap = device.Capabilities.Find(DeviceCapabilityId.DuplexEnabled);
            // if DuplexEnabled capability supported
            if (duplexEnabledCap != null)
            {
                // set value of DuplexEnabled capability
                duplexEnabledCap.SetValue(true);
            }
                
            // close the device
            device.Close();
                
            // close the device manager
            deviceManager1.Close();
        }
    }
    Requirements

    Target Platforms: Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also