VB.NET code to acquire multiple images from a TWAIN scanner
A sample .NET application using TwainControlX
This VB.NET example shows how to acquire a series of images from a TWAIN device, typically a scanner equipped with an Automatic Document Feeder (ADF).
To use this demo, you will need to download two files:
Install TwainControlX, then extract the VB.NET demo files from TCXMult1VBNET.zip, keeping the same directory structure. Start VB.NET, and open the project in solution file 'TCX_Mult1_VBNET\TCX_Mult1_VBNET.sln'.
Run the project and click the Start button. A list of the TWAIN devices installed on your system will be displayed. Select one of the devices and up to 5 images will be captured and saved to disk as files "Image1.bmp" etc.
The user interface is disabled by the command 'AxTwain1.UseInterface = False'. The number of images to be acquired is set by the command 'AxTwain1.ImagesToRead = 5'. Either of these settings can be modified if required.
After each image is acquired, the code in 'AxTwain1_OnAcquire' will run. This saves the image to disk and displays it in a PictureBox.
Images are saved in the working directory of the VB project. The code can be edited and a full path to the file can be specified to save to any other location.
Scanning will stop either when 5 images have been read, or when the ADF is empty.
Note that the demo has been prepared using the 2010 version of VB. For a copy of the demo compatible with older versions of VB.NET download the following ZIP file: