Hello World
This program that is next is a type of translator. It is not at all advanced or anything like that, it just three different languages to say Hello World. I know that it doesn’t seem all that productive, but it helps you learn about option buttons. Something new *wiggles eyebrows*
1.) Open VB and start a Standard EXE
2.) Put a label at the top of the form
Clear out the words from the label so that what you want will come up.
3.) Near the bottom of the form you will need to put a frame.
Run your mouse over the left hand toolbox slowly and you will find that on of the little buttons is a Frame. The name of the frame, under caption in the properties will be ‘Select a language” or something to that effect.
4.) Inside of the frame you will put in three option buttons.
You can put them one underneath another, or side by side, but there should be three. The names of these captions will be names of languages, like English, French, Spanish, German, etc.
5.) Under the frame you can put in a command button
This command button will have no function but to close the program down, the ‘Done’ button
6.) Double click on the command button
The code that you will put in here will be nice and simple and shut the entire program off:
Private Sub Command1_Click()
Unload Me
End Sub
Simple, easy and a command that you should put on to every program that you make. Like a back door if you have something going that you’re not allowed to. You don’t need it, but I recommend it. You can close the code window down if you want or go to the left hand scroll bar and select ‘Option1’ .
7.)
Double
click(or you used the scoll to get there) on the
first option button
The code in this is going to be the same for the other two option buttons,
but the words that will come up will be different:
Private Sub Option1_Click()
Label1.Caption = “Hello World”
End Sub
That was English. Change the words for the next part:
Private Sub Option2_Click()
Label1.Caption = “Hola Mundo”
End Sub
That
and was Spanish. For the final option button:
Private Sub Option3_Click()
Label1.Caption = “Bonjour le Monde”
End Sub
That was French.
When that is done you can play the program to see if it
worked. Once you’ve done that you can go back and start to change the names of
the labels and options.
The Options: optEnglish
optSpanish
optFrench
The Label: lblMessage
The Command: cmdDone
When that is done you have to go back through you’re code
and change all your old names it these ones so that the program works.