I want to make a simple picture slideshow from the stated folder. The label show the full location detail of the image, how can the label show the picture name only?
- int counter = 0;
- private void button1_Click(object sender, EventArgs e)
- {
- timer1.Start(); //start the slideshow
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- counter++;
- string path = @"C:\Users\Tan Wei Shen\Desktop\FYP\Animal";//directory of the picture
- string[] filePaths = Directory.GetFiles(path, "*.jpg ");
- if (counter > filePaths.Length - 1)
- {
- counter = 0; //reset the picture
- }
- pictureBox1.Image = Image.FromFile(filePaths[counter]); //show image
- label1.Text = filePaths[counter]; //show name of the image
- }

Bryian TanRank #396 · 6.3K reputationPosted Nov 1, 2017, 7:08 PM EDT
Nilesh PatilRank #1,129 · 1.6K reputationPosted Nov 1, 2017, 8:57 PM EDT
Bryian TanRank #396 · 6.3K reputationPosted Nov 2, 2017, 10:27 PM EDT