10 pts.
 how do i make a button with more than one use in visual basic?
i want a button to do one thing the first time i click it then do something different when i click it the second time. how do i do this?

Software/Hardware used:
visual basic 2008 express edition
ASKED: December 31, 2009  5:21 PM
UPDATED: January 2, 2010  12:08 PM

Answer Wiki:
This requires a static (not shared) local variable in your click method. For example: <pre>Static SecondUse As Boolean = False</pre> and in your code <pre>If Not SecondUse Then 'firstime stuff SecondUse = True 'etc ...</pre>
Last Wiki Answer Submitted:  January 2, 2010  12:08 pm  by  BobBeechey   750 pts.
All Answer Wiki Contributors:  BobBeechey   750 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The easiest way to do that would be to use a counter – each time the button is pressed, increment the counter and then check if it is the first time or not.

 1,410 pts.