You can also find out how to do this in the Your First Program tutorial.
Let's make a button that exits the program. Go to the handy little tool bar on the right and click on the button for making buttons. Go to the form and drag the mouse to make a button. At the moment the button will read Command1. You can change that with the caption property. To find out how to change what the button says read the caption tutorial. Make the caption say Exit. You also need to change the button name. To find out how to change the name of a button go to the Changing the name of a label, button, ect. tutorial. Change the name to cmdExitProg. Why? The name cmdExitProg tells you what the button does. It EXITs the PROGram. The cmd part tells you that it is a command. Now on the form, double click on your button. You will now see actual program code. It will read.
Private Sub cmdExitProg_click()
End Sub
This is the Sub routine for the button. Anything that you put inside of the Sub will be carried out when your button is pushed(clicked). Inside of this sub we will put End. Like this:
Private Sub cmdExitProg_click()
End
End Sub
Run your program. Try clicking on your button. Did it work? If not check your code. You might have done something wrong. Click here to download this program. If you can't seem to get this to work, you can email us for help.
| Back | Top |
Copyright ©2000 by Kyle Baker. Please read our disclaimer.