VintaSoft Twain .NET SDK 14.1: Руководство для .NET разработчика
В этом разделе
    Как выбрать TWAIN устройство без отображения диалогового окна выбора TWAIN устройства?
    В этом разделе
    Вот C#/VB.NET код, который демонстрирует, как выбрать TWAIN устройство по имени:
    /// <summary>
    /// Select the device by the device name.
    /// </summary>
    public void SelectDeviceByName(Vintasoft.Twain.DeviceManager deviceManager, string deviceName)
    {
        // open TWAIN device manager
        deviceManager.Open();
    
        // select the device by device name
        Vintasoft.Twain.Device device = deviceManager.Devices.Find(deviceName);
        // if device is not found
        if (device == null)
            // throw exception
            throw new System.Exception("Device is not found.");
    
        // acquire images asynchronously
        device.Acquire();
    }
    
    ''' <summary>
    ''' Select the device by the device name.
    ''' </summary>
    Public Sub SelectDeviceByName(deviceManager As Vintasoft.Twain.DeviceManager, deviceName As String)
            ' open TWAIN device manager
            deviceManager.Open()
    
            ' select the device by device name
            Dim device As Vintasoft.Twain.Device = deviceManager.Devices.Find(deviceName)
            ' if device is not found
            If device Is Nothing Then
                    ' throw exception
                    Throw New System.Exception("Device is not found.")
            End If
    
            ' acquire images asynchronously
            device.Acquire()
    End Sub