Visual Basic | Introduction
Visual Basic is a programming language and development environment created by Microsoft. It is an extension of the BASIC programming language that combines BASIC functions and commands with visual controls. Visual Basic provides a graphical user interface GUI that allows the developer to drag and drop objects into the program as well as manually write program code.
Visual Basic, also referred to as "VB," is designed to make software development easy and efficient, while still being powerful enough to create advanced programs. For example, the Visual Basic language is designed to be "human readable," which means the source code can be understood without requiring lots of comments. The Visual Basic program also includes features like "IntelliSense" and "Code Snippets," which automatically generate code for visual objects added by the programmer. Another feature, called "AutoCorrect," can debug the code while the program is running.
Programs created with Visual Basic can be designed to run on Windows, on the Web, within Office applications, or on mobile devices. Visual Studio, the most comprehensive VB development environment, or IDE, can be used to create programs for all these mediums. Visual Studio .NET provides development tools to create programs based on the .NET framework, such as ASP.NET applications, which are often deployed on the Web. Finally, Visual Basic is available as a streamlined application that is used primarily by beginning developers and for educational purposes.
Features of Visual Basic
GUI Interface
VB is a Graphical User Interface (GUI) language. This means that a VB program will always show something on the screen that the user can interact with (usually via mouse and keyboard) to get a job done. The first step in building the VB program is to get the GUI items on the screen. This is done via pull-down menus that list the available graphical objects. Every system is slightly different (Mac differs from Windows and VB4 Differs from VB6) but, generally speaking, left-clicking on an object allows you to describe attributes like size and position. Right clicking allows you to write code. For example, if the GUI item is a switch, left-clicking would allow the programmer to say how big the switch was, how it was labeled and where on the screen it is positioned. Right-clicking on the switch would bring up a window that allows the programmer to write the code that describes what happens when the user clicks the switch.
Modularization
It is considered good programming practice to modularize your programs. Instead of thinking of a computer program as a single large collection of code, the good programmer writes code so that you never need to look at more code than fits on the screen (or page) at one time. If you program in modules like this, the program is easier to understand and easy to update. Updating will likely be done by someone else so it is import that the program be easy to understand. Small (page size) modules where it is clearly indicated what comes into the module and what goes out makes a program easy to understand. VB forces you to program in a modular fashion because each GUI item contains part of the code---the part that applies to that GUI item.
Object Orentation
Object Oriented Programming (OOP) is a concept where the programmer thinks of the program in "objects" (however abstract the objects may be) that interact with each other. In OOP, all the code associated with that object is in one place. Once again, VB forces this good programming practice. The GUI items are the objects and all the code associated with the object are just a click away. This natural way of enforcing good programming practices---plus the ease of programming in BASIC---is exactly why VB has found so many devoted fans.
The Integrated Development Environment(IDE)
One of the most significant changes in Visual Basic 6.0 is the Integrated Development Environment (IDE). IDE is a term commonly used in the programming world to describe the interface and environment that we use to create our applications. It is called integrated because we can access virtually all of the development tools that we need from one screen called an interface. The IDE is also commonly referred to as the design environment, or the program.
Tha Visual Basic IDE is made up of a number of components
·
Menu Bar
· Tool Bar
· Project Explorer
· Properties window
· Form Layout Window
· Toolbox
· Form Designer
· Object Browser
Menu Bar
This Menu Bar displays the commands that are required to build an application. The main menu items have sub menu items that can be chosen when needed. The toolbars in the menu bar provide quick access to the commonly used commands and a button in the toolbar is clicked once to carry out the action represented by it.
Toolbox
The Toolbox contains a set of controls that are used to place on a Form at design time thereby creating the user interface area. Additional controls can be included in the toolbox by using the Components menu item on the Project menu.
Project Explorer
Docked on the right side of the screen, just under the tollbar, is the Project Explorer window. The Project Explorer as shown in in figure servres as a quick reference to the various elements of a project namely form, classes and modules. All of the object that make up the application are packed in a project. A simple project will typically contain one form, which is a window that is designed as part of a program's interface. It is possible to develop any number of forms for use in a program, although a program may consist of a single form. In addition to forms, the Project Explorer window also lists code modules and classes.
Properties Window
The Properties Window is docked under the Project Explorer window. The Properties Window exposes the various characteristics of selected objects. Each and every form in an application is considered an object. Now, each object in Visual Basic has characteristics such as color and size. Other characteristics affect not just the appearance of the object but the way it behaves too. All these characteristics of an object are called its properties. Thus, a form has properties and any controls placed on it will have propeties too. All of these properties are displayed in the Properties Window.
Object Browser
The Object Browser allows us to browse through the various properties, events and methods that are made available to us. It is accessed by selecting Object Browser from the View menu or pressing the key F2. The left column of the Object Browser lists the objects and classes that are available in the projects that are opened and the controls that have been referenced in them. It is possible for us to scroll through the list and select the object or class that we wish to inspect. After an object is picked up from the Classes list, we can see its members (properties, methods and events) in the right column.
A property is represented by a small icon that has a hand holding a piece of paper. Methods are denoted by little green blocks, while events are denoted by yellow lightning bolt icon.
Control
|
Control
|
Description
|
|
Pointer
|
Provides a way to move and resize the controls form
|
|
PictureBox
|
Displays icons/bitmaps and metafiles. It displays text or acts as a visual container for other controls.
|
|
TextBox
|
Used to display message and enter text.
|
|
Frame
|
Serves as a visual and functional container for controls
|
|
CommandButton
|
Used to carry out the specified action when the user chooses it.
|
|
CheckBox
|
Displays a True/False or Yes/No option.
|
|
OptionButton
|
OptionButton control which is a part of an option group allows the user to select only one option even it displays mulitiple choices.
|
|
ListBox
|
Displays a list of items from which a user can select one.
|
|
ComboBox
|
Contains a TextBox and a ListBox. This allows the user to select an ietm from the dropdown ListBox, or to type in a selection in the TextBox.
|
|
HScrollBar and VScrollBar
|
These controls allow the user to select a value within the specified range of values
|
|
Timer
|
Executes the timer events at specified intervals of time
|
|
DriveListBox
|
Displays the valid disk drives and allows the user to select one of them.
|
|
DirListBox
|
Allows the user to select the directories and paths, which are displayed.
|
|
FileListBox
|
Displays a set of files from which a user can select the desired one.
|
|
Shape
|
Used to add shape (rectangle, square or circle) to a Form
|
|
Line
|
Used to draw straight line to the Form
|
|
Image
|
used to display images such as icons, bitmaps and metafiles. But less capability than the PictureBox
|
|
Data
|
Enables the use to connect to an existing database and display information from it.
|
|
OLE
|
Used to link or embed an object, display and manipulate data from other windows based applications.
|
|
Label
|
Displays a text that the user cannot modify or interact with.
|

0 comments:
Post a Comment