1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

display image on picture box control which got From Biometric device in c#

Discussion in 'C#' started by ranjeetsingh_6, Apr 27, 2007.

  1. ranjeetsingh_6

    ranjeetsingh_6 New Member

    Hi
    I am working on Biomatric Solution Project.I am using SecuGen BSP Device for This purpose.Device return Finger image data in string .I want to display this Finger image into Picture Box Control. For This I kept The output string in Byte array and then i write it in Memory Stream and at last
    create a bitmap to display image(at this stage i got error "Parameter is Not Valid")

    Problem:-Code Give error when i create a bitmap to display image.
    red line show the error point.The error syntax is "Parameter is Not Valid".

    My Code is:-
    Code:
    try
    {
        //Create Device API Interface object
        SECUBSPCOMLib.APIInterface objSecuBSP = new SECUBSPCOMLib.APIInterface();
        long deviceID;
        objSecuBSP.EnumerateDevice();
        //Open Device
        objSecuBSP.OpenDevice(2);
        string szFIRTextData;
        objSecuBSP.Enroll(null);
        //Get Data of Image(Fingure Print) into a string
    
        szFIRTextData = objSecuBSP.FIRTextData;
    
        //Get string into Stream Format means into Byte array from string
        byte[] arrBytes = new byte[szFIRTextData.Length];
        int i = 0;
        foreach (char c in szFIRTextData.ToCharArray())
        {
            arrBytes[i] = (byte)c;
            i++;
        }
        // Open a stream for the image and write the bytes into it
        System.IO.MemoryStream memStream = new System.IO.MemoryStream(arrBytes, true);
        memStream.Write(arrBytes, 0, arrBytes.Length);
        // Create a bitmap from the stream for Display it on Picture Box Control
        System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(memStream);
        pictureBox1.Image = bmp;
        memStream.Close();
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
     
    Last edited by a moderator: Apr 27, 2007

Share This Page