Faisal Ansari

Faisal Ansari

  • NA
  • 382
  • 598.7k

Exception : Parameter is not valid ....

Oct 6 2012 4:00 AM

i am writing code for byteArray convert into image  or bitmap 

code is below

 ArrayList pics = tw.TransferPictures();
                        EndingScan();
                        tw.CloseSrc();
                        picnumber++;
                        for (int i = 0; i < pics.Count; i++)
                        {
                            IntPtr img = (IntPtr)pics[i];
                            PicForm newpic = new PicForm(img);
                            
                            int a = img.ToInt32();
                            byte[] byteArray = new byte[a];
                            MemoryStream ms = new MemoryStream(byteArray);
                            Bitmap returnImage = new Bitmap(ms);
                            returnImage.Save("D:\\UploadArchive\\" + i + ".jpg");

                            newpic.MdiParent = this;
                            int picnum = i + 1;
                            newpic.Text = "ScanPass" + picnumber.ToString() + "_Pic" + picnum.ToString();
                            newpic.Show();
                        }

when compiler excute this line 

Bitmap returnImage = new Bitmap(ms);

exception occures " Parameter is not valid "


reply soon


Thanks


Answers (1)