Visual Basic is a very user friendly programing language that makes Windows Applications.
First, we will make the Programmers are Lovable program. The objective of this program is to display the words "Programers are Lovable" when the user clicks on the control button.
To create this, we must create a new project name and new form. Create the project in the file menu and the Form in the Project menu.
The form is the base that all VBasic files are created on. It is like a sheet of paper that you are about to draw on.
These are your basic windows in creating your programs. The controls
in the Toolbox can be placed on your form to create different things and
effects. This button creates the command button that is needed and the
one above creates the text box.
The form(window) should have command boxes and a text box. In order to recaption the command button, right click on one and go to the properties section. Scroll down until you find the caption property and Programmers are Lovable. Most simple coding in Visual Basic is just modifying the basic properties in some way.
The syntax for almost everything is
[control_name1].[property] = [control_name2].[property].
text1.text = text2.textThe above code assigns the value of text2's text to text1's text. Your always assigning the second value to the first variable (properties are variables too.) For our Programmers are Lovable program. Double click on the control button that says Programmers are Lovable and then a text screen should appear that shows:
And enter in:
Now if you run the program by pressing F5 or the button and press on the command button then it should display "Programmers are Lovable" in the text box.
If you want to add another button to clear it then do the same thing except the code would be text1.text = "" and this would be our final version.
The ' is a comment and anything on the same line after the ' will not be run and in most versions will turn green (color coding). These comments will in no way effect your coding.
Comments are very useful in large programs but in small programs they
are not needed. Anyway, I suppose we have done enough for now. In the next
chapter we will discuss operators and conditions.
HOME NEXT CHAPTER