Picture slide show
I want Picture show (image viewer)and this code is not working Please Help
PictureBox[] arrpic = new PictureBox[5];
arrpic[0] = pic1;
arrpic[1] = pic2;
arrpic[2] = pic3;
foreach (PictureBox pb in arrpic)
{
picshow.Show(pb);
}
yousafc#
Junior Poster in Training
98 posts since Feb 2011
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0
A PictureBox is a control and thus needs to be added to a form. You'll need to set the positions and size of the PictureBox before you add it to the forms control collection.
Momerath
Senior Poster
3,726 posts since Aug 2010
Reputation Points: 1,322
Solved Threads: 624
Skill Endorsements: 12
Please send me complete code of image viewer in picture box
yousafc#
Junior Poster in Training
98 posts since Feb 2011
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0
On line 1 of your code you created an array of 5 PictureBoxes.
You still have to create the PictureBoxes!
Line 2 will give a NullReferenceException!
You have to do something like this:
arrpic[0] = new PictureBox();
arrpic[0].Image = Properties.Resources.Pic1;
ddanbe
Industrious Poster
4,277 posts since Oct 2008
Reputation Points: 2,121
Solved Threads: 720
Skill Endorsements: 26