Conversion Error

"Hevel, Shawn" <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <790D2AC6CCD881429F56FC43921DB8C102E95319__42564.5668329254$1168007107$gmane$org@scfbi000exc2.scfbins1.com>
I'm trying to convert a System.Byte[] into System.Drawing.Image.  I've
included my code below.  When I execute System.Drawing.Image.FromStream(ms)
I get the following error: System.ArgumentException:  Parameter is not
valid.  Does anyone have an idea as to why this is throwing an error?



public System.Drawing.Image ByteArrayToImage(Byte[] byteArrayIn)

{

    MemoryStream ms = new MemoryStream(byteArrayIn);

    System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);

    return returnImage;

}



Thanks,



Shawn Hevel, API, AIT
Lead Programmer Analyst
Information Technology Department
South Carolina Farm Bureau Insurance Companies
Phone: (803) 936-4331
Fax: (803) 936-4629
Work Email: [email protected] <mailto:[email protected]>
Home Email: [email protected]




===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.