This is My Code I could not fingur out the code for Next Picture in my array

      int imagenume;
      string[] imagepat = new string[imagenum];

     private void button3_Click(object sender, EventArgs e)
            {  



            OpenFileDialog open = new OpenFileDialog();
            open.Multiselect = true;
            if (open.ShowDialog() != DialogResult.Cancel)
            {
                for (imagenum =0; imagenum < imagepat.Length; imagenum++)
                {
                    lblcounter.Text = imagenum.ToString();
                    imagepat[imagenum] = open.FileName;
                    myimage = Image.FromFile(imagepat[imagenum]);
                    pictureBox1.Image = myimage;


                }

            }
        }

My Question in how can code in Next Button For Next Picture Show in Picture Box
Thanks&Regards
Yousafc#

Do away with the for-next loop. Move the code inside the loop to a subroutine. Give the subroutine 1 parameter the number of the image to show. When starting the show pass 0 to the subroutine. In the Next button code use the value of lblcounter.text + 1, after verifying it is less then imagepat.Length. I'm not on my regular computer but it looks like you might need some code to put all the filenames in imagepat.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.