Tnou Study Center

Blog Owner: Vignesh A





Search This Blog

Monday, February 17, 2014

What is Visual Basic?

VISUAL BASIC is a high level programming language which  evolved from the earlier DOS version called BASIC. BASIC means Beginners' All-purpose Symbolic Instruction Code. It is a relatively easy programming language to learn. The code looks a lot  like English Language. Different software companies produced different versions of BASIC, such as Microsoft QBASIC, QUICKBASIC, GWBASIC ,IBM BASICA and so on. However, people prefer to use Microsoft Visual Basic today, as it is a well developed programming language and supporting resources are available everywhere. Now, there are many versions of VB exist in the market, the most popular one and still widely used by many VB programmers is none other than Visual Basic 6http://www.assoc-amazon.com/e/ir?t=liewvoonkiong&l=as2&o=1&a=141962895X . We also have VB.net, Visual Basic 2005, Visual Basic 2008http://www.assoc-amazon.com/e/ir?t=liewvoonkiong&l=as2&o=1&a=B007LL7590 and the latest Visual Basic 2010http://www.assoc-amazon.com/e/ir?t=liewvoonkiong&l=as2&o=1&a=1467975192 Both Vb2008 and VB2010 are fully object oriented programming (OOP) languages.


VISUAL BASIC is a VISUAL and  Event-driven Programming Language. These are the main divergence from the old BASIC. In BASIC, programming is done in a text-only environment and the program is executed sequentially. In VB6, programming is done in a graphical environment. In the old BASIC, you have to write program code for each graphical object you wish to display it on screen, including its position and its color. However, In VB6 , you just need to drag and drop any graphical object anywhere on the form, and you can change its properties  using the properties window. 

In addition, Visual Basic 6 is Event-driven because we need to write code in order to perform some tasks in response to certain events. The events usually comprises but not limited to the user's inputs. Some of the events are load, click, double click, drag and drop, pressing the keys and more. We will learn more about events in later lessons. Therefore, a VB6 Program is made up of many subprograms, each has its own program code, and each can be executed independently and at the same time each can be linked together in one way or another.

TNOU BCA PRACTICAL FOR 2ND YEAR TIME TABLE


Visual Programing


BCA Second year -   BCA-P2

For Practical Record Call me@9551111120       
 

 Lab2- covering
                       
   1 .Windows Programming 
2. Software Engineering (call me or mail me)
3. Visual BasicPrograming

1 windows programing 

Write in Detail with Screen shoot..

Very simple

1. How to open notepad in windows? and how to save?

For Eg:

AIM:
  To Write a small note in Notepad and save

ALGORITHM:
  • IN THE WINDOWS TASK BAR, SELECT THE START MENU
  • IN THE START MENU SELECT THE PROGRAM
  • FROM THE PROGRAM SELECT THE ACCESSORIES
  • IN ACCESSORIES SELECT NOTEPAD, NOTEPAD APPLICATION OPENS
 TO CREARE NEW FILE
1) CTRL+N

TO SAVE FILE

TYPE THE TEXT
AND SAVE CTRL+S


2. How to open Calculater and how to use?



3.  How to open Ms office,(word, Excel, Powerpoint)

4.Change Wall paper in Computer?

5.What is Control pannel?

6. How to back Desktop?




(3) Visual Programing

(I) Create a Simple Calculator in Visual Basic 6.0

Step 1
Open Visual Basic 6.0, and create a new Standard EXE, Project. Standard EXE projects give you a handful of commands and tools, useful to develop simple as well as semi-complex programs.

You can also choose a VB Enterprise Edition Project which will give you a lot more tools to work with. For a beginner programmer, it is suggested to use a Standard EXE Project.
 


Step 2 
 Understand the project screen. In the center of the screen will be a box with a lot of dots. This is your form. A form is the place where you will add the various elements (command buttons, pictures, text boxes, etc) to your program.

    To the left of the screen is the toolbox. The Toolbox contains various pre-defined elements of any program. You can drag and drop these elements onto your form.



 Step 3

Understand the project screen. In the center of the screen will be a box with a lot of dots. This is your form. A form is the place where you will add the various elements (command buttons, pictures, text boxes, etc) to your program.

    To the left of the screen is the toolbox. The Toolbox contains various pre-defined elements of any program. You can drag and drop these elements onto your form.




To the lower right of the screen is the form layout. This determines where your program will be displayed on the screen once the project is complete and executed.


On the mid-right is the properties box which determine the property of any element that is selected in a form. You can change various properties using this. If no element is selected, it displays the properties of the form.
On the top-right is the project explorer. It shows the various designs, forms that are included in a project.

 If any of these boxes is missing, you can add them by clicking on the "View" button on the Menu bar.



 Drag a label onto the form, and change the caption of the label to "Enter first number". The caption of a label can be changed using the properties box



Create a textbox to the right of the first label. Remove any text that appears inside the textbox by changing blanking the "Text" field in properties box. 

Create another label and change the caption to "Enter second number" and create another textbox to its right.
  Drag and create four command buttons below these two labels. Change the caption of these command buttons to "Add", "Subtract", "Multiply", "Divide" respectively. 


 Create another label with a caption "Result" and a textbox to the right of it below the four command buttons. This textbox will be used to display the result. With this, your design is complete

 To start coding, in the project explorer, click on the form and then select the left-most button. It will take you to the coding screen. Click on the list box in the top-left of the coding screen. One by one, click on all the commands (Command1, Command2, etc) so that the outline coding of them will be visible to you on your coding screen.

  
Declare the variables. To declare: Dim a, b, r as Integer


 a is the value entered in the first textbox, b is the value entered in the second textbox and r is the result. You can any other variables too.


Start the coding for the add command (Command1). The code will be as follows: Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
r = a + b
Text3.Text = r
End Sub

 

Code for the subtract command (Command2). The code will be as follows: Private Sub Command2_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
r = a - b
Text3.Text = r
End Sub




Code for the multiply command (Command3). The code will be as follows: Private Sub Command3_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
r = a * b
Text3.Text = r
End Sub


 
 Code for the divide command (Command4). The coding will be as follows: Private Sub Command4_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
r = a / b
Text3.Text = r
End Sub


  
Click the start button or press F5 to execute your program. Test all the commands and see if your program is working.




***********************************************************************************************