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

MessageBox doesn't show in the AcquireCompleted event

Aug 12, 2016 at 8:06 PM
Hello guys!

I does not understand what is happening with my code .. If i put MessageBox out of AcquireCompleted event it work's!

I'm doing something like this:

class Scanner{
    public Scanner(){
               _twain.AcquireCompleted += new EventHandler(complete);
    }

    private void complete(object sender, EventArgs e){
             if (
            MessageBox.Show(
            "Successful!", "Information",
            MessageBoxButtons.OK,
            MessageBoxIcon.Information,
            MessageBoxDefaultButton.Button1) == DialogResult.OK);
    }
}

Thank's everybody!

Peter.
Coordinator
Aug 13, 2016 at 5:56 AM
Hello, pogs17.
Try process the Twain32.AcquireError event.
Aug 15, 2016 at 2:10 PM
Edited Aug 15, 2016 at 2:10 PM
Hello, SARAFF.

Ok, but this event is useful when an error occurs.

I want to show a message when the scan process is finished. When i used 'MessageBox.Show' out of the event 'AcquireCompleted' it work's! Instead no ..

Thanks for your help!
Coordinator
Aug 15, 2016 at 5:33 PM
Edited Aug 15, 2016 at 5:37 PM
Hello, pogs17.
Probably, during the Acquire process occurs exception. In this case, instead the Twain32.AcquireCompleted event occurs the Twain32.AcquireError event. Check a ConditionCode property and inner exception (if it set) and him a StackTrace.
Marked as answer by SARAFF on 8/27/2016 at 7:08 AM