Hi,
I want to write a for..next loop...for a "For next " button...
when clicked, the loop will execute for a short period (This time should be kept track of by the counter) and stop.....
When the button is clicked "For next"...the speed of the object should increase and then stop....The object should move 5 times(or how ever), then stop..
i tried this but it's not workin..am lost...

Private Sub ForNextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xForNextButton.Click


For Counter = 0 To 1000
'do somtething----the something i want to do is repeat the moving process 5 times (or what ever) and at a fast speed---how do i write that
Next


Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Counter = 1000
        xCounterTextBox.Text = Counter

I'm lost just trying to read that, can you try and get someone to translate it into English please? What's a "for next" button? lol. And what's this object you randomly mention? lol. You have to make sense, and be specific about your problems, if you expect any help.

sorry
"for..next" is the name of a button

Reposting...

1.I have created a moving object (which is a button) in a form (rectangle box) called "Enjoy Button" and it moves when
2. a specific button named "Start Timer" is pressed...When the "Start Timer" button is pressed, the
3. "xTimer" event is called and the button moves in a rectangle box and bounces of the walls...=animation

4. However, i need to write a For..Next Loop in the
5."For Next " Button= a button named for next
6.and also put a counter in the loop to control the animation time..
7.The loop should stop at a certain time, and the object too should stop at that time,at a new location


this is what i have so far

Private Sub ForNextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xForNextButton.Click, xTimer.Tick
        Dim MyTime As Integer = 5
        Counter = 1000

        For Counter = 0 To 1000
            xTimer.Enabled = MyTime * 1
            ' Move the button for a set amount of time
            ' Exit the loop

        Next

OK, that's much easier to read, I will try some stuff out, and post later today, kinda tired now. Just a note, you might want to use a second timer, instead of the counter, to control the animation time.

thanks...actually i have to create
1.a "for...next loop" to up date an animated ball location , 5 times.
2. the ball moves in a form and bounces off four walls.
3..the "for...next loop" will be activated when the "for..next button" is clicked..
4..then the ball will move to another location.....it has nothing to do with time...

I just realized what i want trying to do first wasn't going to make sense

this is what i have so far

Private Sub ForNextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xForNextButton.Click, xTimer.Tick
        Me.xTimer.Enabled = False
        'Me.xTimeStartButton.Click.enabled = False

        For i As Integer = 0 To 5

            xEnjoyButton.Location = New Point(i, i)
            Threading.Thread.Sleep(2)

        Next i

        

        xButtonLabel.Text = "Button(" & xEnjoyButton.Location.X.ToString & "," & xEnjoyButton.Location.Y.ToString & ")"


    End Sub

but am stuck.....help plz

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.