List boxes | A list box is simply a box which displays several lines of text. The user can scroll up and down the list, and select any one of the strings in the list (sometimes any number of them can be selected). |
Combo boxes | A combo box is just a list box where only one line is normally displayed. A small button sits next to the text, and when clicked, displays a list box, allowing the user to select any one of the items in the list. |
Picture boxes | When you want to display a graphic on your form, you use a Picture box. A Picture box simply serves as a container for a graphic image; change its Image property to be the filename of the graphic you want to display. |
Timers | Timers are invisible controls that execute a certain procedure (e.g. chunk of code) at a certain interval. Timers have three major properties
|
Scroll bars | I'm sure you know what a scroll bar is; there's one on the right-hand side of your web browser window, which lets you scroll up and down the page. A scroll bar control, however, is not actually attached to anything; it just sits on the form. It's usually used like a slider control (e.g. if you want someone to control the volume of a sound that's being played, you could place a scroll bar on the form and let users move the scroll bar according to the volume that they want). Scroll bars have five major properties: Value (which is the position that scroll bar is currently at), Min (the minimum possible value for Value), Max (the maximum possible value), SmallChange (the amount that Value changes when one of the arrow buttons on the scroll bar is clicked), and LargeChange (the amount that Value changes when the user clicks the scroll shaft between the scroll box and one of the arrow buttons). |
Random Numbers | Random numbers can be created in code by using the Rnd function, which returns a random number between 0.0 and 0.999999. Here's an example: temp = Int(Rnd * 10 + 1) This sets temp equal to a random number between 1 and 10. |
Message boxes | Let's say you want to generate an alert window when the user tries to enter invalid data into your program. This is best done with a Message Box, like so: result = MsgBox("The value you tried to enter is invalid. Please try again.", vbOKOnly, "Invalid Data" This pops up a message box that says "The value you tried to enter is invalid. Please try again." The title of the window will be "Invalid Data", and only an OK button will be displayed. For a complete list of button types, read Visual Basic's Help on MsgBox Function. |