hi ,can any one help me.actually what i have to do in my project is load a barcode encoded many picture files at once in the picture box one after the other so that its barcode is decoded.as the barcode is decoded of the first picture actually barcode contains email address so as the first picture is decoded the compose form opens and the image attachment is attached and it is send.after that second picture which was selected comes its barcode is encoded then again the image is attached at load event of the form and then it is sent.now here the first problem i am having is that first time when i load pic as application it considers picture box empty,but as second time i click on load and select files it starts functioning.other thing i dont know how to access array indiviuial element if its length is growing according to selection of files.well i am pasting my code here kindly help me out.
thanks.

private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {

            if (ofd1.ShowDialog() == DialogResult.OK)
            {
                o = ofd1.FileNames;



                foreach (object s in o)
                {

                    for (int t = 0; t <= 100; t++)
                    {

                        pictureBox1.ImageLocation = s.ToString();
                        
                    }
                        if (pictureBox1.Image != null)
                        {

                            DateTime dtStart = DateTime.Now;
                            int iScans = 100;

                            // For maximum performance in Code39 scanning you could use this configuration,
                            // would make scanning of just Code39 about twice as fast as the default:
                            //BarcodeImaging.UseBarcodeZones = False
                            //BarcodeImaging.FullScanBarcodeTypes = BarcodeImaging.BarcodeType.Code39
                            BarcodeImaging.FullScanPage(ref barcodes, (Bitmap)pictureBox1.Image, iScans);
                            //  BarcodeImaging.FullScanPage(barcodes, pictureBox1.Image, iScans);

                            // Show the results in a message box
                            ShowResults(dtStart, iScans, ref barcodes);
                            Form1 f = new Form1();
                            f.Show();
                        }

                        /// <summary>
                        /// Show the reults of the barcode scan in a message box.
                        /// </summary>
                        /// <param name="dtStart">Start time of scan</param>
                        /// <param name="iScans">Number of scans done</param>
                        /// <param name="barcodes">List of barcodes found</param>
                    
                }
            }
        }

this code is for loading picture in picture box ,decoding image ,making new instance for compose form.

private void Form1_Load(object sender, EventArgs e)
    {
try
            {

              
                    string[] arr = barcodescanning.o;
                    alAttachments = new ArrayList();
                    textBox5.Text = string.Empty;

                    alAttachments.AddRange(arr);
                
                 foreach (string s in alAttachments)
                 {
                     
                         textBox5.Text = s;
                     }}

>when i load pic as application it considers picture box empty

Look at line #13 to #18. Unnecessary loop.

foreach (object s in o)
 {
   pictureBox1.Image= Image.FromFile(s.ToString());
   if (pictureBox1.Image != null)
   ....

>i dont know how to access array indiviuial element if its length is growing according to selection of files.

Check the upper bound or length of array.

thnx for the reply.but the prob i had before was the pictures were so quickly retrieved that always i get last pic in picturebox so i thought to bring delay hence i put up a loop.

This article has been dead for over six months. Start a new discussion instead.