65.9K
CodeProject is changing. Read more.
Home

Use the same button to perform start and stop

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (1 vote)

Jun 17, 2010

CPOL
viewsIcon

8492

This trick is really meant for novice programmers...

Declare this in the general section inside the class:
dim flag as integer = 1
and then copy and paste the following code inside the button's click event:
If (flag = 1) Then
     'write down the statements to start...
Else
     'write down the statements to stop...
End If
flag *= -1