title: how to retrieve images from the database to 4 picture boxes in the loop
body: <p>I have a winform application (VS 2008) that has 4 picture boxes, one button (Upload). I want to picture boxes recorded images from a database (sql server 2005) in order from first to last, when I click the button. For example: press the button, the first picture box shows the first image, push the button, the second picture shows another picture box, etc.. and then that first picture box shows the fifth image. </p>
  
  <pre><code>pb1 = img1, pb2 = img2, pb3 = img3, pb4 = img4, pb1 = img5,..pb4 = img8,pb1 = img9,..etc..
  </code></pre>
  
  <p>So, there was a loop.
  I have this piece of code, but he recorded only one image in a picture box.</p>
  
  <pre><code>private void btnSHow_Click(object sender, EventArgs e)
  {
      SqlConnection connect = new SqlConnection("Data Source=JOHNO-PC\\SQLEXPRESS;Initial Catalog=DB_TraficSigns;Integrated Security=True");
      SqlCommand command = new SqlCommand("SELECT picture FROM Tab_Sign ORDER BY id", connect);
  
      SqlDataAdapter dp = new SqlDataAdapter(command);
      DataSet ds = new DataSet("Tab_Sign");
  
      byte[] MyData = new byte[0];
  
      dp.Fill(ds, "Tab_Sign");
      DataRow myRow;
      myRow = ds.Tables["Tab_Sign"].Rows[0];
  
      MyData = (byte[])myRow["picture"];
  
      MemoryStream stream = new MemoryStream(MyData);
      pb1.Image = Image.FromStream(stream);
  
  }
  </code></pre>