Now I want to add the number of picture boxes to windows form dynamically. for eg. when user put the input in text box such as user enter 4 then Four picture boxes are added to the form at run time.
also I don't know how handle the context menu event also at run time for the above picture boxes in win form............
void textBox1_TextChanged(object sender, EventArgs)
int num =0;
if(int.TryParse(textBox1.Text, out num))
pbs = new PictureBox[num];
int x = 20, y = 20;
for(int i = 0; i < pbs.Lenght; i++)
pbs[i] = new PictureBox();
pbs[i].Name = "pictureBox" + (i + 1);
pbs[i].Location = new Point(x, y); //location point
pbs[i].Size = new Size(300,200); //custom!!
//setting new point for next pictureBox:
//this code will put 2 pictureBoxes in a row
//if more then 2, next two will be put in a new row:
if(i % 2 == 0)
x = 20;
y += 220;
x += 320;
This is only an example code, you can position pictureboxes by your way.
Hope it helps.