VB.NET - Loop Delay

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FPyro
    New Member
    • Oct 2008
    • 1

    VB.NET - Loop Delay

    Hey, I try to delay a loop, but the "animatedgi f" don't move at all, when I place another loop inside the loop.

    Thanks for the help

    Code:
    Private Sub PictureBox2_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseDown
    Dim d As Integer
    Dim p As Integer
    For d = 0 To 500
    For p = 0 To 100
    Next p
    animatedgif.Location = New System.Drawing.Point(animatedgif.Location.X + 0.1, animatedgif.Location.Y)
    Next d
    End Sub
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Maybe threading would be more useful if it is a delay you are searching for?

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Do no forget that for your changes to UI to show up, the windows messages must be force-processed.
      Either with (whateverobject ).Update()/.Refresh(), or by using Application.DoE vents();

      Comment

      Working...