I don't know whats wrong with your code. Difficult to understand your exact problem from your question. But in your code I don't see any code to change the label text. One little tip: You change the PictureBox's "Name" during the method, after that you use this name to identify the picturebox. I'd recommend you use the "Tag" property of the picturebox instead to store your "flag" (true/false) to know which picture should be shown.
Anyway changing the properties at runtime should work. Your code seems to work. Just add code to change the label text too.
An example how to handle this situation: Copy/Paste in a new Forms project and replace Program.cs with the following:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
namespace PictureBoxWithLabel
{
static class Program
{
[STAThread]
static void Main()
{
string strFolderWithPictures = Environment.GetFolderPath(Environment.SpecialFolder.CommonPictures);
string[] astrImages = Directory.GetFiles(strFolderWithPictures, "*.jpg", SearchOption.AllDirectories);
int iShownPicture = 0;
Form form = new Form();
Label label = new Label();
label.Dock = DockStyle.Bottom;
label.Text = "Click on the PictureBox!";
PictureBox picturebox = new PictureBox();
picturebox.SizeMode = PictureBoxSizeMode.StretchImage;
picturebox.BackColor = Color.Black;
picturebox.Dock = DockStyle.Fill;
picturebox.Click += delegate(object sender, EventArgs ea)
{
if (astrImages.Length > 0)
{
PictureBox pbSender = sender as PictureBox;
pbSender.Image = new Bitmap(astrImages[iShownPicture]);
label.Text = astrImages[iShownPicture];
iShownPicture = astrImages.Length >= iShownPicture + 1 ? ++iShownPicture : 0;
}
};
form.Controls.Add(label);
form.Controls.Add(picturebox);
Application.Run(form);
}
}
}