Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   display image on picture box control which got From Biometric device in c# (http://www.go4expert.com/forums/display-image-picture-box-control-t4039/)

ranjeetsingh_6 27Apr2007 11:32

display image on picture box control which got From Biometric device in c#
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:-

    //Create Device API Interface object
    SECUBSPCOMLib.APIInterface objSecuBSP = new SECUBSPCOMLib.APIInterface();
    long deviceID;
    //Open Device
    string szFIRTextData;
    //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;
    // 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;
catch (Exception ex)

All times are GMT +5.5. The time now is 01:56.