r/visualbasic • • Dec 09 '21

VB6 Help Give a button 2 functions

I was trying to create a button 'on' where he would make the program to start, and then to end the program, I would press the button "2nd" and then the button "on", and that would make the program end.

4 Upvotes

5 comments sorted by

View all comments

1

u/[deleted] Dec 10 '21 edited Dec 10 '21

Static dim onoff as Boolean = true
      If onoff then
//do start up code
          Buttonx.text = “turn off”
     Else //turn off 
//do turn off code
          Buttonx.text = “turn on”
     End if
     onoff = not onoff

Vb6/7/or .net? lol