Visual basic

=:Visual Basic:=6.0

Defination:-

Ø Visual Basic is an object oriented programming  language of Microsoft Basic studio graph  which is an extension of the language Basic                                                                                                                      

The aim to use Visual Basic for creating and manipulating data object and ole object (object linking embedding).

      GUI è Graphical User Interface

How to open Visual Basic ?

Click Start   èall programè MS-Visual Studio 6.0      Clickè MS-Visual Basic 6.0è click open.

How to save Visual Basic:-

Click file è click save projectè type file name è click save type project name è click save

How to open the saving project:-

      File è open è open project  è No   è All file selectè your è open      è view project exploreè form.

*     Visual Basic project file extent ion name:- .VBP

*     Visual Basic Form file extent ion name:- .FRM

-:Visual Basic tools:-

Objects:-                           The tools what we use in a program to create the design to the program.

There are so many object: —

Viz, form object, command, button, label, control,   xt box etc.

Proceeded:-          Proceeded  is the way by which a control can execute a job.

Event:-         The necessary action taken by a control at runtime generally known as event.d

 Shortcut key:-

1)        F4              To show the properties windows.

2)      F7               To show the code windows.

3)      Shift+F7           Object in design view.

4)      F5               Run.

5)       

2. The concept of Object Oriented Programming:-

One of the main ideas of object-oriented programming is that all of the data and procedures related to a particular object are kept together with the object itself. In Visual Basic, an object’s data (settings or attributes) are called properties, while the various procedures that can operate on the object are called its methods.

Programming with data access objects consists of creating object variables, and manipulating them by invoking their methods and setting their properties.

3. properties, Events and Methods of an Object:-

Properties: – Properties are the attributes, which you set or retrieve for an object.

Methods: – Built-in procedure that can be invoked to impart some action to a particular object.

Event Procedures: – Events are also notifications that certain operations are about to occur, or have already occurred.

 Variables:-

Visual Basic, like most programming languages, uses variables, for storing values. Variables have a name ( the word you use to refer to the value the variable contains) and a data type ( which determines the kind of data the variable can store).

Declaring variables:-

To declare a variable is to tell the program about it in advance. You declare a variable with the Dim statement, supplying a name for the variable:

Dim variablename [As type]

Exchanging strings and numbers:-

Private sub command1_click()

Dim intX as integer

Dim strY as string

StrY=”100.23”

IntX=strY                                    passes the string to a numeric variable.

List1.additem cos(strY)      adds cosine of number in the string to the listbox.

Operators:-

1. Arithmetic Operators ( +,-,*,/,\, ^, Mod and &)

2. Relational or comparison operators:( =,>,<,>=,<= and <>).

3. Logical operators: ( Not, And, Or, and Xor)

Hierarchy of Operators:

1. Equality (=)

2. Not

3. Inequality (<>)

4. And

5. Multiplication and Division( * and /)

6. Less than (<)

7. Or

8. Greater than

9. Less than or Equal to (<=)

10.            Addition and Subtraction (+ and -)

11.            Greater than or Equal to (>=)

12.            String Concatenation(&)

Elements of Visual Basic IDE:-

The VB IDE consists of the following elements.

·      1. Manu Bar

·      2. Context Menus

·      3. Toolbars

·      4.Toolbox

·      5. Project Explorer Window

·      6. Properties Window

·      7. Object Browser

·      8. Form Designer

·      9. Code Editor Window

·      10. Form Layout Window

·      11. Immediate, Locals and Watch Windows.

Ø The Toolbox is the selection menu for controls used in your application.

Pointer           picture box     

Label            text box 

Frame        command box

Check box       option box

Combo box           list box

Horizontal scroll    vertical scroll bar                                                     

Timer                drive list box                

Directory list box      file list box 

Shapes                                     lines

Image box          Data tool

Object linking                                    

Working with some common controls:-

Label                 Can be used  to provide display- only access to a       specified text data field

Text box         can be used to provide read/write access to a specified text data field .probably ,the most widely used data bound tool.

Command button       used to provide execution of some code driven activities.

Check box      used to provide read/write access to a Boolean field.

Combo box    can be use3d to provide read/write access to a text data field.

List box          can be used to provide read/ write access to a text data field.

Picture box     used to display graphical image from a bitmap, icon, or metafile on your form. Provide read / write access to a image  \ binary data field.

Image box      used to display a graphical image form a bitmap icon or metafile on your form (uses fewer recourses then a picture box). Provides read/write access to a image  \ binary data field.

The contorts statements available in visual basic:-

1.if-then else

2.if –then else if

3.select case

4.do while

5.do loop while

6.foor next

For checking multi conditions, one can use multiple Else if as shown below:-

If<condition1>then

Instruction1

Else if<condition2>then

Instruction2

Else If<condition3>then

Instruction3

End if

————:-END OF THEORY CHAPTER:———-

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart