VB Section 2.1 (PPT)

Download Report

Transcript VB Section 2.1 (PPT)

Chapter 2 –Visual Basic,
Controls, and Events
2.1 An Introduction to Visual Basic
2.2 Visual Basic Controls
2.3 Visual Basic Events
1
2.1 An Introduction to
Visual Basic 2010
• From BASIC to VB
• How to Develop a
Visual Basic
Application
• Processing in an
Event Driven
Language
• The Different Versions
of Visual Basic
Sequential or Event Driven
2
From BASIC to VB
• BASIC
• Sequential statements
controlled by the
programmer
• Little chance to edit data
Before GUIs text was entered one
line at a time and there was often
no going back to fix errors.
Enter Your Name: John Smith
Enter Your Address: 1200 West
Park Street
Enter Your City: Evanston
Enter Your State: Wyoming
Enter Your Zip Code:58924
• VB
• Language used to create
windows applications.
• Provides a Graphical User
Interface or GUI.
• The sequence of instructions
executed in the program is
controlled by user events.
GUIs allowed users to view and
edit an entire set of data before
submitting it.
3
How to Develop a Visual
Basic Application
Interface – layout of
the labels, textboxes,
and buttons
Basic Steps
1. Design the Interface
for the user.
2. Determine which
events the controls
on the window should
recognize.
3. Write the event
procedures for those
events.
In this case the controls are the Write
to Database and Exit. The events for
each button are click events. The
Write to Database procedure sends
the forms data to storage. The Exit
procedure ends the program or at
least the data entry process.
4
Program Execution In An
Event Driven Language
1.
2.
3.
4.
VB monitors the controls in a window looking for any event the control may
recognize
When an event is activated, VB looks for a corresponding event procedure
If the procedure is found, the VB executes the code, otherwise does
nothing.
Goes back to step 1
5
Different Versions of Visual
Basic
•
•
•
•
•
•
•
•
Version 1.0 – 1991 Version 2.0 – 1992
Version 3.0 – 1993 Version 4.0 – 1995
Version 5.0 – 1997 Version 6.0 – 1998
Visual Basic.NET – 2002 (NOT BACKWARD
COMPATIBLE WITH EARLIER VERSIONS)
Visual Basic 2005 – November 2005
Visual Basic 2008 – November 2007
Visual Basic 2010 – April 2010
Visual Basic 2012 -- ???
6