You are on page 1of 8

SUMBILON, AUSTINE COULINE G.

BASIC COMPUTER

BSIT-2ND YEAR

PROGRAMMING LANGUAGE
A programming language is a formal constructed languagedesigned to communicate instructions to a machine,
particularly a computer. Programming languages can be used to createprograms to control the behavior of a
machine or to expressalgorithms.
The earliest programming languages preceded the invention of the digital computer and were used to direct the
behavior of machines such as Jacquard looms and player pianos.Thousands of different programming languages
have been created, mainly in the computer field, and many more still are being created every year. Many
programming languages require computation to be specified in an imperative form (i.e., as a sequence of
operations to perform), while other languages utilize other forms of program specification such as
thedeclarative form (i.e. the desired result is specified, not how to achieve it).
The description of a programming language is usually split into the two components of syntax (form)
and semantics(meaning). Some languages are defined by a specification document (for example,
the C programming language is specified by an ISO Standard), while other languages (such as Perl) have a
dominant implementation that is treated as a reference.

DEFINITION
A programming language is a notation for writing programs, which are specifications of a computation
or algorithm.[2] Some, but not all, authors restrict the term "programming language" to those languages that can
express all possible algorithms.[2][3] Traits often considered important for what constitutes a programming
language include:

Function and target


A computer programming language is a language used to write computer programs, which involve
a computerperforming some kind of computation[4] or algorithm and possibly control external devices such
as printers, disk drives,robots,[5] and so on. For example, PostScript programs are frequently created by another
program to control a computer printer or display. More generally, a programming language may describe
computation on some, possibly abstract, machine. It is generally accepted that a complete specification for a
programming language includes a description, possibly idealized, of a machine or processor for that
language.[6] In most practical contexts, a programming language involves a computer; consequently,
programming languages are usually defined and studied this way.[7] Programming languages differ from natural
languages in that natural languages are only used for interaction between people, while programming

languages also allow humans to communicate instructions to machines.

Abstractions
Programming languages usually contain abstractions for defining and manipulating data structures or controlling the flow
of execution. The practical necessity that a programming language support adequate abstractions is expressed by
theabstraction principle;[8] this principle is sometimes formulated as recommendation to the programmer to make proper
use of such abstractions.[9]

Expressive power
The theory of computation classifies languages by the computations they are capable of expressing. All Turing
completelanguages can implement the same set of algorithms. ANSI/ISO SQL-92 and Charity are examples of
languages that are not Turing complete, yet often called programming languages.[10][11]
Markup languages like XML, HTML or troff, which define structured data, are not usually considered
programming languages.[12][13][14] Programming languages may, however, share the syntax with markup
languages if a computational semantics is defined. XSLT, for example, is a Turing complete XML
dialect.[15][16][17] Moreover, LaTeX, which is mostly used for structuring documents, also contains a Turing
complete subset.[18][19]
The term computer language is sometimes used interchangeably with programming language.[20] However, the
usage of both terms varies among authors, including the exact scope of each. One usage describes programming
languages as a subset of computer languages.[21] In this vein, languages used in computing that have a different
goal than expressing computer programs are generically designated computer languages. For instance, markup
languages are sometimes referred to as computer languages to emphasize that they are not meant to be used for
programming.[22]
Another usage regards programming languages as theoretical constructs for programming abstract machines,
and computer languages as the subset thereof that runs on physical computers, which have finite hardware
resources.[23] John C. Reynolds emphasizes that formal specification languages are just as much programming
languages as are the languages intended for execution. He also argues that textual and even graphical input
formats that affect the behavior of a computer are programming languages, despite the fact they are commonly
not Turing-complete, and remarks that ignorance of programming language concepts is the reason for many
flaws in input formats.[24]

VISUAL BASIC
Visual Basic is a third-generation event-driven programming languageand integrated development
environment (IDE) from Microsoft for itsCOM programming model first released in 1991. Microsoft intended
Visual Basic to be relatively easy to learn and use.[1][2] Visual Basic was derived from BASIC and enables
the rapid application development (RAD) of graphical user interface (GUI) applications, access
todatabases using Data Access Objects, Remote Data Objects, or ActiveX Data Objects, and creation
of ActiveX controls and objects.
A programmer can create an application using the components provided by the Visual Basic program itself.
Over time the community of programmers have developed new third party components, keeping this
programming language to modern standards.[3][4][5][6][7] Programs written in Visual Basic can also use
the Windows API, which requires external function declarations. Furthermore, new third party functions (which
are open source) using part VB6 source code and part embedded machine code, make the Visual Basic 6.0
applications faster than those designed in C++.[3][8]

The final release was version 6 in 1998 (now known simply as Visual Basic). Though Visual Basic
6.0 IDE is unsupported as of April 8, 2008, the Visual Basic team is committed to It Just Works
compatibility for Visual Basic 6.0 applications on Windows Vista, Windows Server 2008including
R2, Windows 7, and Windows 8.[9] In 2014 there are hundreds of thousands of developers who still
prefer Visual Basic 6.0 over Visual Basic .NET.[3][10] Moreover, in recent years some developers
lobbied aggressively for a new version of Visual Basic 6.0.[11][12][13] [14] A dialect of Visual Basic, Visual
Basic for Applications (VBA), is used as a macro or scripting language within several Microsoft
applications, includingMicrosoft Office.[15]

HISTORY OF VISUAL BASIC


VB 1.0 was introduced in 1991. The drag and drop design for creating the user interface is derived from a prototype form
generator developed by Alan Cooper and his company called Tripod.[citation needed][discuss] Microsoft contracted with Cooper and his
associates to develop Tripod into a programmable form system for Windows 3.0, under the code name Ruby (no relation to the
later Ruby programming language).
Tripod did not include a programming language at all. Microsoft decided to combine Ruby with the Basic language to create
Visual Basic.
The Ruby interface generator provided the "visual" part of Visual Basic and this was combined with the "EB" Embedded
BASIC engine designed for Microsoft's abandoned "Omega" database system. Ruby also provided the ability to loaddynamic
link libraries containing additional controls (then called "gizmos"), which later became the VBX interface.[19]

Timeline Description

Project 'basic Thunder' was initiated in 1990.[20]

Visual Basic 1.0 (May 1991) was released for Windows at the Comdex/Windows World trade show in Atlanta, Georgia.

Visual Basic 1.0 for DOS was released in September 1992. The language itself was not quite compatible with Visual Basic for
Windows, as it was actually the next version of Microsoft's DOS-based BASIC compilers, QuickBASIC and BASIC
Professional Development System. The interface used a Text user interface, using extended ASCII characters to simulate the
appearance of a GUI.

Visual Basic 2.0 was released in November 1992. The programming environment was easier to use, and its speed was
improved. Notably, forms became instantiable objects, thus laying the foundational concepts of class modules as were later
offered in VB4.

Visual Basic 3.0 was released in the summer of 1993 and came in Standard and Professional versions. VB3 included version 1.1
of the Microsoft Jet Database Engine that could read and write Jet (or Access) 1.x databases.

Visual Basic 4.0 (August 1995) was the first version that could create 32-bit as well as 16-bit Windows programs. It has three
editions; Standard, Professional, and Enterprise. It also introduced the ability to write non-GUI classes in Visual Basic.
Incompatibilities between different releases of VB4 caused installation and operation problems. While previous versions of

Visual Basic had used VBX controls, Visual Basic now used OLE controls (with files names ending in .OCX) instead. These
were later to be named ActiveX controls.

With version 5.0 (February 1997), Microsoft released Visual Basic exclusively for 32-bit versions of Windows. Programmers
who preferred to write 16-bit programs were able to import programs written in Visual Basic 4.0 to Visual Basic 5.0, and Visual
Basic 5.0 programs can easily be converted with Visual Basic 4.0. Visual Basic 5.0 also introduced the ability to create custom
user controls, as well as the ability to compile to native Windows executable code, speeding up calculation-intensive code
execution. A free, downloadable Control Creation Edition was also released for creation ofActiveX controls. It was also used as
an introductory form of Visual Basic: a regular .exe project could be created and run in the IDE, but not compiled.

Visual Basic 6.0 (Mid-1998) improved in a number of areas[21] including the ability to create web-based applications. Visual
Basic 6.0 has entered Microsoft's "non-supported phase" as of March 2008. Windows Vista, Windows Server 2008 and
Windows 7, no longer support the Visual Basic 6.0 development environment, but still support the runtime.[22]Microsoft
announced in February 2012 that they support the runtime in Windows 8.[23]

Mainstream Support for Microsoft Visual Basic 6.0 ended on March 31, 2005. Extended support ended in March 2008.[24]In
response, the Visual Basic user community expressed its grave concern and lobbied users to sign a petition to keep the product
alive.[25] Microsoft has so far refused to change their position on the matter.[26] Ironically, around this time (2005), it was exposed
that Microsoft's new anti-spyware offering, Microsoft AntiSpyware (part of the GIANT Company Software purchase), was
coded in Visual Basic 6.0.[27] Its replacement, Windows Defender, was rewritten in C++.[28]

SAMPLE CODE OF HELLO WORLD USING VB6


This is a free online Visual Basic 6.0 Hello World tutorial for students
new to coding with Microsoft's Visual Basic 6.0 programming language.
Each step in using the IDE (Integrated Development Environment) to
complete the Hello World project is explained in detail.

Above:
Clear and Exit are buttons named
cmdClear and cmdExit. The white box
is a text box named txtHello.

Purpose of the project: To


display the text "Hello
World!" in a text box
control, to be able to clear
the text from the text box
using a command button,
and to exit the project using
a command button. Open
Visual Basic 6.0. Open a
Standard .exe project.
Maximize the whitebackground project form by
clicking on the middle
maximize button to the right
of the Project1 title bar.
Directions follow for
naming the Project:

To name the project, double -click in the project window on the


P r o j e c t 1 i c o n . L o o k i n t o t h e P r o p e r t i e s B o x w h e r e i t n o w s a ys
(Name) Project1 and double -click on (Name). This should now
h i g h l i g h t t h e t e x t , P r o j e c t 1 . I f P r o j e c t 1 i s h i g h l i g h t e d j u s t t yp e
H e l l o W o r l d ( n o s p a c e s ) . P r e s s t h e E n t e r k e y. T h e p r o j e c t i s n o w
named HelloWorld.
You could similarly highlight the form in the project window,
double-click the form icon, and find the name property for the
F o r m 1 i n t h e P r o p e r t i e s W i n d o w , t h e n r e n a m e i t , i f yo u s o d e s i r e . I
did not rename the Form1 for this Hello World demonstration. To
p l a c e a t e x t b o x o n t o yo u r f o r m f i n d t h e t e x t b o x c o n t r o l i n s i d e t h e
t o o l b o x t o t h e l e f t o f yo u r w o r k a r e a . D o u b l e - c l i c k o n t h e t e x t b o x
t o p u t a t e x t b o x o n t o yo u r f o r m . U s e t h e r e s i z i n g h a n d l e s t o s i z e i t
the way you wish and drag the control using the left mouse button to
m o v e i t w h e r e yo u w o u l d l i k e t o h a v e i t p l a c e o n yo u r f o r m . S e l e c t
the text box so that selection handles (resizing handles) appear
around the text box control. In the properties window scroll to the
text property and where the text reads Text1, highlight Text1 using
your mouse, and delete it using the delete key . Press Enter. Now the
t e x t b o x c o n t r o l o n t h e f o r m s h o u l d a p p e a r t o b e e m p t y. W i t h t h e
Text1 object still highlighted, double click on the name property so
t h e I - b e a m o f t h e c u r s o r i s i n s i d e t h e b o x w h e r e yo u w i l l n a m e t h e
t e x t b o x o b j e c t . T y p e t x t H e l l o a n d p r e s s t h e E n t e r k e y.
To place the 3 command buttons onto your form, find the command
button control object in the tool box and double -click on the
c o m m a n d b u t t o n 3 t i m e s t o p l a c e t h r e e b u t t o n s o n t o yo u r f o r m . U s e
the left mouse in the down position to drag each command button
into place. Select the first command button by clicking it with the
mouse one time. Selection handles (called resizing handles) appear
around the command button. When an object is selected the
properties for that particular object appear in the Properties window.
D o u b l e - c l i c k o n t h e n a m e p r o p e r t y a n d t yp e a n a m e : c m d H e l l o .
S c r o l l d o w n t o t h e c a p t i o n p r o p e r t y a n d d o u b l e - c l i c k c a p t i o n : T yp e
&Display Hello. The ampersand is located above the number 7 on the
k e yb o a r d . P r e s s t h e E n t e r K e y.
Note: When the ampersand (&) is used before a letter in a caption,
the letter following the ampersand is underlined. Any underlined
letter in a caption may be used in combination with the ALT key +
t h e u n d e r l i n e d l e t t e r a s a k e yb o a r d s h o r t - c u t t o a c c e s s t h a t c o n t r o l .
A user may press ALT + D instead of clicking with the mouse on the
first command button, the one with the caption Display Hello.
Now name the second command button:
S e l e c t t h e s e c o n d c o m m a n d b u t t o n s o t h a t yo u s e e t h e r e s i z i n g
handles. In the Properties window, double -click on (Name) and name
this button cmdClear. Double -click on the Caption property in the
properties window and give it a Caption of Clear. (The C should be

underlined in the caption, for this project.) Press the Enter key .
( N O T E : S o m e t i m e s yo u w i l l w a n t t o u n d e r l i n e a d i f f e r e n t l e t t e r i n
o t h e r p r o j e c t s . P l a c e t h e a m p e r s a n d b e f o r e t h e l e t t e r yo u w i s h t o
underline. Do not have the same letter underlined more than once in
a project window. Two different captions should not each have an
underlined D. Pick a different letter to underline when this happens.
S e l e c t a l e t t e r t h a t h a s n o t ye t b e e n u s e d t o u n d e r l i n e i n a c a p t i o n ) .
Name the third command button:
S e l e c t t h e t h i r d c o m m a n d b u t t o n s o t h a t yo u s e e t h e r e s i z i n g h a n d l e s
around the third command button. In the Properties window, double click on the (Name) property and name it cmdExit. Make the Caption
property E&xit with the ampersand before the x so that the x will be
u n d e r l i n e d . P r e s s t h e E n t e r k e y. N o w y o u h a v e n a m e d a n d l a b e l e d
t h e E x i t k e y.
SUMMARY: You have opened a standard .exe project and named the
project HelloWorld. The form was not renamed by me but is still
c a l l e d F o r m 1 . R e n a m e t h e f o r m i f yo u w i s h . Y o u h a v e p l a c e d o n e
t e x t b o x a n d 3 c o m m a n d b u t t o n s o n t o y o u r f o r m a n d yo u h a v e n a m e d
the controls and given the command buttons separate captions. (A
caption on a button is what the user sees on that button.) Text boxes
do not have a caption. Use the .text property for text boxes. You
have deleted default text fro m the text box control to make it appear
e m p t y, a n d h a v e n a m e d t h i s c o n t r o l , t x t H e l l o . N o w yo u w i l l c o d e t h e
command button controls.
To access the code window with a sub procedure already started for
you double-click on the cmdHello button with the capt ion that
r e a d s D i s p l a y H e l l o . T h i s d o u b l e - c l i c k a c t i o n t a k e s yo u t o t h e c o d e
w i n d o w w h e r e yo u s e e a l i n e r e a d i n g P r i v a t e S u b c m d H e l l o _ C l i c k ( )
a n d a n o t h e r l i n e r e a d i n g E n d S u b . P l a c e yo u r c u r s o r b e t w e e n t h e s e
t w o l i n e s a n d i n d e n t o n c e u s i n g t h e t a b k e y. T yp e
t x t H e l l o . T e x t = " H e l l o W o r l d ! " . U s e t h e q u o t e s t h i s t i m e w h e n t yp i n g
t h a t l i n e . P r e s s t h e E n t e r k e y. O n t h e n e x t l i n e i n d e n t o n c e u s i n g t h e
t a b k e y a n d t yp e W i t h t x t H e l l o , t h e n p r e s s t h e E n t e r k e y . O n t h e
next line indent twice using the tab key and
t yp e . f o n t = " A r i a l " u s i n g t h e p e r i o d b e f o r e f o n t a n d q u o t e s a r o u n d
A r i a l . P r e s s t h e E n t e r k e y. A f t e r t h e . f o n t = " A r i a l " l i n e , o n t h e l i n e
b e l o w i n d e n t t w i c e u s i n g t h e t a b k e y a n d t yp e . F o n t S i z e = 1 6 ( n o
quotes but must have the period before .FontSize. Press the Ent er
k e y. O n t h e n e x t l i n e i n d e n t t w i c e u s i n g t h e t a b k e y a n d
t yp e . F o r e C o l o r = v b B l u e ( n o q u o t e s , j u s t t h e p e r i o d b e f o r e
ForeColor. (You are almost through with this control). You will only
i n d e n t o n c e o n t h e n e x t l i n e , u s i n g t h e t a b k e y. T yp e E n d W i t h a n d
press the Enter key. Allow the last line of text for this sub procedure
to read End Sub (no period). You have now coded the entire
cmdHello sub procedure which will place text into the txtHello
control when the program runs, will change the text to a 16 poin t

Arial font and the text color (ForeColor) will be blue.


From the Visual Basic menu bar, click on View and select Object to
get back to the form. You will code the sub procedure now for the
second command button, the cmdClear button with the caption
of Clear:
Double-click on the cmdClear button on the form. In the code
window and following the line of text that reads Private Sub
c m d C l e a r _ C l i c k ( ) , i n d e n t o n c e u s i n g t h e t a b k e y. T yp e
txtHello.Text="", that is two quotes without a space or any content
between them. This represents an empty string which appears as an
empty text box when the cmdClear button is clicked or accessed
f r o m t h e k e yb o a r d ( A l t + C ) . Y o u a r e a l r e a d y t h r o u g h c o d i n g t h e
cmdClear event. Let the last line of this event to be the End Sub. Go
back to View, Object to return to the form.
You will code the cmdExit procedure. Double -click on the cmdExit
button. In the event procedure beginning Private Sub cmdExit_Click,
d r o p d o w n o n e l i n e , i n d e n t , a n d t yp e E n d ( n o p e r i o d ) . T h a t ' s i t !
R e t u r n t o t h e f o r m ( V i e w , O b j e c t ) a n d r u n yo u r p r o c e d u r e ( F 5
b u t t o n ) . T h e t o t a l c o d e f o r yo u r p r o j e c t l o o k s l i k e t h i s :
Private Sub cmdClear_Click()
txtHello.Text = ""
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdHello_Click()
txtHello.Text = "Hello World!"
With txtHello
.Font = "Arial"
.FontSize = 16
.ForeColor = vbBlue
End With
End Sub

Visual Basic is not a command line program so the order of the


c o d e d e v e n t s d o e s n o t m a t t e r i n yo u r c o d e . N o e v e n t w i l l b e
triggered unless the user accesses a command button either by
c l i c k i n g o n i t o r u s i n g yo u r c o d e d s h o r t - c u t k e y w i t h t h e A l t k e y.
The only thing that makes a click event work is by the user
"clicking" on something (or using the coded short -cut). If the user
clicks on a command button and no code is written, nothing will
happen either. A user event is a mouse click, a key press, dragging

the mouse over a certain area, and so forth. When a user event
occurs and that object has a sub procedure cod ed for that user event,
then the code will run. The programmer only programs what will
happen "IF" a user event occurs.
The programmer cannot control the user. If I, the user, do not drag
my mouse cursor over some magic area that is programmed, then
nothing will happen even though the programmer went to all that
trouble to write the code for a "mouse over" event. This is what is
meant b y the term "event -driven programming language". (In a
command line program the code would run in sequence, one line
after another, regardless of any user events.)