private void OnCaptured(CaptureResult captureResult)
    {
        try
        {
            // Check capture quality and throw an error if bad.
            if (!_sender.CheckCaptureResult(captureResult)) return;
            count++;
            DataResult<Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI);
            SendMessage(Action.SendMessage, "A finger was captured.  \r\nCount:  " + (count));
            if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS)
            {
                _sender.Reset = true;
                throw new Exception(resultConversion.ResultCode.ToString());
            }
            preenrollmentFmds.Add(resultConversion.Data);
            if (count >= 4)
            {
                DataResult<Fmd> resultEnrollment = DPUruNet.Enrollment.CreateEnrollmentFmd(Constants.Formats.Fmd.ANSI, preenrollmentFmds);
                if (resultEnrollment.ResultCode == Constants.ResultCode.DP_SUCCESS)
                {
                    SendMessage(Action.SendMessage, "An enrollment FMD was successfully created.");
                    SendMessage(Action.SendMessage, "Place a finger on the reader.");
                    preenrollmentFmds.Clear();
                    count = 0;
                    return;
                }
                else if (resultEnrollment.ResultCode == Constants.ResultCode.DP_ENROLLMENT_INVALID_SET)
                {
                    SendMessage(Action.SendMessage, "Enrollment was unsuccessful.  Please try again.");
                    SendMessage(Action.SendMessage, "Place a finger on the reader.");
                    preenrollmentFmds.Clear();
                    count = 0;
                    return;
                }
            }
            SendMessage(Action.SendMessage, "Now place the same finger on the reader.");
        }
        catch (Exception ex)
        {
            // Send error message, then close form
            SendMessage(Action.SendMessage, "Error:  " + ex.Message);                
        }  
    }

Your post has a few issues.

  1. Use the forum code formatter.
  2. STATE what your questions are.
  3. If the code is failing, supply what line it is and the error output.
  4. Share how you debug your code. I find that I use my IDE to break on that line and look at the variables in the call. Can you do this?
    If not why not add a line of code to print out the values for you to check.
commented: While you were commenting on the code formatting I was busy correcting it ;-P +15

I don't see a question.

commented: While I was commenting on the code you were busy correcting. Not everyone understands my humor. At least my code is far more understandable. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.