Guide for VB.NET
Core Document Formats
Additional Features
Open and Close Connection to Twain Devices

VB.NET TWAIN - Open and Close Device Connection

How to Open and Close Connection to TWAIN Device for VB.NET Image Scanning

VB.NET
Home > .NET Imaging SDK > VB.NET > TWAIN: Open and Close Connection to Twain Devices
To get started with DocImage SDK for .NET, you are supposed to read VB.NET Imaging: Get Started first!

For TWAIN scanning, developers and users may need to open and close connection to TWAIN device. This article talks about several questions on opening & closing connection to TWAIN device in VB.NET application.
Related .net document control helps:
powerpoint viewer asp.net mvc: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
asp.net view text file: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net office document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net edit pdf page control: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net annotate pdf control: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net mvc pdf editor control: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
  • Why do you need to open and close connection to TWAIN device in VB.NET application?
  • What preparations should be made for opening and closing connection to TWAIN device in VB.NET?
  • What DLLs and APIs can be used to open and close connection to TWAIN device in VB class?
  • What demo code will be utilized to open and close connection to TWAIN device in VB.NET project?
  • Why choose our product to open and close connection to TWAIN device through VB.NET programming?
View the following parts carefully and you will find answers to all of the above questions on connecting and disconnecting to TWAIN device using VB.NET program.
Reasons for Connecting and Disconnecting to TWAIN Device
There are reasons for opening and closing connection to TWAIN device in VB.NET application respectively. First of all, if you are intending to query and set properties of TWAIN device, you need to open a connection to the TWAIN device beforehand. Thus, you are able to retrieve needed original settings of the TWAIN device. Then, you need to close the connection to the TWAIN device manually when you have finished properties setting or image acquiring through VB.NET programming. Only if the connection is closed, original settings of the TWAIN device will be recovered.
Preparations to Be Made
In order to open and close connection to TWAIN device with our VB.NET TWAIN Image Scanning Add-On, it is necessary to make some preparations. At first, TWAIN should be installed and at least one TWAIN device will be accessible. Next, there should be a proper developing platform for using this Add-On to connect and disconnect to TWAIN device for image scanning, like .NET Framework 2.0 or later versions and Visual Studio 2005 or later versions. Surely, operating system for Windows XP or above is suitable for using our product.
DLLs and APIs

DLLs for Connecting and Disconnecting to TWAIN Device

Generally, two advanced dlls (RasterEdge.Imaging.Basic.dll and RasterEdge.Imaging.TWAIN.dll) will be used to open and close connection to TWAIN device in VB.NET image scanning program. You just need to add the two dlls to your Visual Studio VB.NET project references.

APIs for Connecting and Disconnecting to TWAIN Device

VB.NET developers are free to use APIs below to open and close connection to TWAIN device. Specifically speaking, you can use Open() method to connect to TWAIN device and use the Close() method to disconnect to TWAIN device.
Private Sub Open() Implements Device.Open
End Sub
Private Sub Close() Implements Device.Close
End Sub
VB.NET Demo Code
The following Visual Basic demo code can be used to open and close connection to TWAIN device in VB.NET programming.
''' <summary>
''' Before you get and set properties of Twain devices, device connection should be opened.
''' </summary>
Public Sub OpenAndCloseTwainConnection()
Dim acq As New Acquisition()

acq.AcquireFinished += New EventHandler(AddressOf OnAcquireFinished)
Dim device As Device = acq.GetAvailbleDevices()

' Query and set some of the device abilities here.
Dim frameTypes As TwainStaticFrameSizeType() = device.GetSupportedFrameSizes()
device.Acquire()
End Sub



Private Sub OnAcquireFinished(sender As Object, e As EventArgs)
Me.device.Close()
End Sub
Note: When finishing image acquiring and if you want to save the acquired image, you need to add event handler to the event.
Why Choose Our Product?

Multiple Functions

Using our VB.NET TWAIN Add-On, you are not only able to open and close connection to TWAIN device, but also capable of achieving featured TWAIN image scanning in VB.NET and specifying image size and location to scan.

High Compatibility

This .NET TWAIN Add-On for VB.NET is entirely compatible with other imaging controls provided by our website. For example, together with our VB.NET web document viewing and annotating controls, you are able to add a web deployed image scanning control to target client application.

Free Trial Version

We offer free trial version of this VB.NET TWAIN Scanning Add-On for you to connect and disconnect to TWAIN device. If you are satisfied with the trial result, you can purchase the formal and correct licenses for commercial use.


Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster Edge.com