That got me on the right track.
/// I put this in the class
private System.Windows.Forms.PictureBox[] pictureBox;
///i put this in the funciton
pictureBox = new System.Windows.Forms.PictureBox[10];
for ( int i = 0; i < pictureBox.Length; i++ )
{
this.pictureBox[i] = new
System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.p ictureBox[i])).BeginInit();
}
Works perfect,,, Thanks !
Tom Spink wrote:
TheLostLeaf wrote:
How do I change this :
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
To This:
for (int i = 1; i < 6; i++)
{
this.pictureBox+(i) = new System.Windows.Forms.PictureBox();
}
Do i need to put it into an array or something? Thanks for any help ...
Hi,
An array would be the way to go:
/// At the top somewhere
private PictureBox[] pictureBox = new PictureBox[6];
///
/// In your code somewhere
for ( int i = 0; i < pictureBox.Length; i++ )
this.pictureBox[i] = new PictureBox();
///
Note that arrays are zero-based.
--
Hope this helps,
Tom Spink
Google first, ask later.