0

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#

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

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.

Edited by tinstaafl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.