This project has moved. For the latest updates, please go here.

_twain_AcquireCompleted not firing

Mar 4, 2014 at 11:43 PM

Am new to Sarafftwain. I using the Sarafftwain dll in sample form. _twain_AcquireCompleted is not firing after the image is scanned. Kindly guide me on this. Below is the code of the form :

Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports Saraff.Twain
Partial Public Class Form1
    Inherits Form
    Private _isEnable As Boolean = False
Private _twain As New Saraff.Twain.Twain32

Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
End Sub

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    Catch ex As TwainException
        MessageBox.Show(ex.Message, "SAMPLE1", MessageBoxButtons.OK, MessageBoxIcon.[Error])
    End Try
End Sub

Private Sub _twain_AcquireCompleted(ByVal sender As Object, ByVal e As EventArgs) Handles _twain.AcquireCompleted
    If Me.PictureBox1.Image IsNot Nothing Then
    End If
    Me.PictureBox1.Image = Me._twain.GetImage(0)
End Sub

Private Sub _twain_TwainStateChanged(ByVal sender As Object, ByVal e As Twain32.TwainStateEventArgs) Handles _twain.AcquireCompleted
    If (e.TwainState And Twain32.TwainStateFlag.DSEnabled) = 0 AndAlso Me._isEnable Then
        ' <<< scaning finished (or closed)
        Me._isEnable = False
    End If
    Me._isEnable = (e.TwainState And Twain32.TwainStateFlag.DSEnabled) <> 0
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Mar 5, 2014 at 1:07 PM
Hello, KingVBNet.
See Saraff.Twain.Sample1.
Mar 18, 2014 at 11:36 AM
Sample code can be downloaded here Saraff.Twain.NET Samples
Marked as answer by SARAFF on 6/23/2014 at 12:36 PM