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............

try:

PictureBox[] pbs;
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!!
            this.Controls.Add(pbs[i]);

            //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;
            }
            else
                x += 320;
        }
    }
}

This is only an example code, you can position pictureboxes by your way.
Hope it helps.

Thank you Mitja for the help
also I don't know how handle the context menu event run time for the above picture boxes to load images dynamically in win form............

This is a new question. Close this thread if you are satisfied with the answer, and create a new thread. We have to follow the forum`s rules.

I`ll be in touch there, bye.

This question has already been answered. Start a new discussion instead.