title: Running Methods Simultaneously
body: <p>I have a Dog class with a method Run which is supposed to move pictures across the screen:</p>
  
  <pre><code>public bool Run()
  {
      Point p = PictureBoxDog.Location;
  
      while(p.X &lt; 530)
      {
          int movement = Randomizer.Next(0, 3);
          p.X += movement;
          PictureBoxDog.Location = p;
      }
  
      if (Location == 4) //Incomplete section.
          return true;
      else
          return false;
  }
  </code></pre>
  
  <p>This method is called from a button click event in which 4 dog objects are created and the each object calls the Run method:</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      Dog dog1 = new Dog(pictureDog1);
      Dog dog2 = new Dog(pictureDog2);
      Dog dog3 = new Dog(pictureDog3);
      Dog dog4 = new Dog(pictureDog4);
  
      dog1.Run();
      dog2.Run();
      dog3.Run();
      dog4.Run();
  }
  </code></pre>
  
  <p>The problem is that each method executes one by one, not simultaneously. I want each method to run at the same time. If I remove the while statement, then all methods execute at the same time, but with the while loop, they execute one after another. Any suggestions on how to fix this problem are greatly appreciated. Run method without the while loop:</p>
  
  <pre><code>public bool Run() //Dog1.Run()
  {
      Point p = PictureBoxDog.Location;
  
      int movement = Randomizer.Next(0, 30);
      //Location += movement;
  
      p.X += movement;
      PictureBoxDog.Location = p;
  
      if (Location == 4) //Incomplete code.
      return true;
      else
      return false;
  }
  </code></pre>