In this section, we are not going into the technical aspects of VB programming; just have a feel of it. Now, you can try out the examples below:
Example 2.1.1 is a simple program. First of all, you have to launch Microsoft Visual Basic. Normally, a default form Form1 will be available for you to start your new project. Now, double click on form1, the source code window for form1 as shown in figure 2.1 will appear. The top of the source code window consists of a list of objects and their associated events or procedures. In figure 2.1, the object displayed is Form and the associated procedure is Load.
When you click on the object box, the drop-down list will display a list of objects you have inserted into your form as shown in figure 2.2. Here, you can see a form, command button with the name Command1, a Label with the name Label1 and a PictureBox with the name Picture1. Similarly, when you click on the procedure box, a list of procedures associated with the object will be displayed as shown in figure 2.3. Some of the procedures associated with the object Form are Activate, Click, DblClick (which means Double-Click) , DragDrop, keyPress and etc. Each object has its own set of procedures. You can always select an object and write codes for any of its procedure in order to perform certain tasks.
You do not have to worry about the beginning and the end statements (i.e. Private Sub Form_Load.......End Sub.); Just key in the lines in between the above two statements exactly as are shown here. When you run the program, you will be surprise that nothing shown up .In order to display the output of the program, you have to add the Form1.show statement like in Example 2.1.1 or you can just use Form_Activate ( ) event procedure as shown in example 2.1.2. The command Print does not mean printing using a printer but it means displaying the output on the computer screen. Now, press F5 or click on the run button to run the program and you will get the output as shown in figure 2.4.
You can also perform simple arithmetic calculations as shown in example 2.1.2. VB uses * to denote the multiplication operator and / to denote the division operator. The output is shown in figure 2.3, where the results are arranged vertically.
Figure 2.1 Source Code Window
Figure 2.2: List of Objects
Nice job, thanks.
Do not forget, next time, to mention your sources.
Your text is coming from http://www.vbtutor.net/lesson2.html
And also do not forget to put between quotes the text written by somebody else.
It is not forbidden here to display somebody else's texte, you simply have to put it between quotes. If you forget the quotes, it's not honest, it's stealing somebody's intellectual property, and it's against our forum rules.
I insterted the quotes for you today. Do not forget to put the quotes next time.
|VIEW DESKTOP VERSION||REGISTER||GET FREE HOSTING|