Click or drag to resize

Device.TryOpen Method

This method will attempt to open a connection to the device and will return true if it was successful. It's preferred to use this method instead of the Open() method.

The Close() method must be called when you are finished using the device.

Namespace:  Atalasoft.Twain
Assembly:  Atalasoft.DotTwain (in Atalasoft.DotTwain.dll) Version: 11.5.0.0.0.156 (.NET 4.6.2, x86)
Syntax
public bool TryOpen()

Return Value

Type: Boolean
True if the device connection was a success.
Remarks
This method will suppress exceptions and instead return true or false to indicate if the device was already open or has been successfully opened.
Examples
if (this.device.TryOpen())
{
    this.device.Resolution = new TwainResolution(200, 200);
    this.device.HideInterface = true;
    this.device.Acquire();
}
See Also