tags:

views:

25

answers:

2

On my form I have one button (button1). When I click this button it starts my app. My app is meant to loop forever. Is there a way for my app to click button1 on the 20th loop?

Here is an example of my app:

**Click button1**
webbrowser.navigate("")
looping:
'some code
'some code
goto looping:
+1  A: 

You'd need a variable to use as a counter, and increment it each time through the loop. During each loop iteration you can test the value of the variable, and if it's equal to 20 then fire the click event on the button.

Andrew Cooper
+1  A: 

I'm not sure if this is what you want, but perhaps this will get you started.

Dim i as Integer =1

Do 
   If i = 20 Then
      Call Button_Click(Nothing, Nothing)
   ElseIf i<=20
       i+=1
   End If

   If shouldExit Then 'some other condition to break out.
       Exit Do
   End If

Loop While True
p.campbell