wait+click

07/27/2016 03:55 mouradhndr#1
Please I want a code in vb net when I click on the button go! then it makes a click on button 2 and wait 2 seconds then makes a click on button 3 and wait 2 seconds then makes a click on button 4 and wait 2 seconds then makes a click on button 5. thank brothers:handsdown::handsdown::handsdown:
07/27/2016 04:24 mouradhndr#2
here ie the interface of the program
07/27/2016 05:17 Mafia67#3
Code:
Button2.PerformClick()
Threading.Thread.Sleep(2000)

Button3.PerformClick()
Threading.Thread.Sleep(2000)
...
07/27/2016 05:46 mouradhndr#4
Quote:
Originally Posted by Mafia67 View Post
Code:
Button2.PerformClick()
Threading.Thread.Sleep(2000)

Button3.PerformClick()
Threading.Thread.Sleep(2000)
...
this code is working but the program waits 2 seconds and then clicks all buttons which is not that i want.I want a click and 2 seconds wait then comes the next click and 2 seconds wait and so untill the last button. Anyway thank you bro:)
07/27/2016 16:23 Mafia67#5
Try this one instead of Thread.Sleep()
Code:
Dim t = Threading.Tasks.Task.Run(Async Function()
                                Await Task.Delay(2000)
                                Button2.PerformClick()
                       End Function)
      t.Wait()
Source: [Only registered and activated users can see links. Click Here To Register...]
07/27/2016 21:37 mouradhndr#6
Quote:
Originally Posted by Mafia67 View Post
Try this one instead of Thread.Sleep()
Code:
Dim t = Threading.Tasks.Task.Run(Async Function()
                                Await Task.Delay(2000)
                                Return 42
                       End Function)
      t.Wait()
Source: [Only registered and activated users can see links. Click Here To Register...]
not working bro:rolleyes:
07/28/2016 20:51 mouradhndr#7
Solved thaks for help brothers
I request closing
07/29/2016 11:55 #Saiirex#8
You can also create a list/array of all buttons and go through it with for each and call the PerformClick method and wait for 2 seconds. In this case it will work theoretic with infinite amount of buttons