Transcript Document
Intermediate Visual Basic
CISP 371
CRC
Prof. Chapman
VB Capabilities
Most people think that Visual Basic is
only useful if you want to build a GUI
program that runs on a desktop PC.
But VB is much more powerful than
that.
CISP 371
Chapman
VB Capabilities
VB can be used to work with databases
and to build web sites.
Who needs Java or Javascript or PHP?
Who needs SQL or Oracle or MySQL?
Not a master VB programmer.
CISP 371
Chapman
VB Capabilities
VB can handle
Windows desktop GUI applications
Windows web applications
Database connectivity
Extension of the language
OOP
Application security
CISP 371
Chapman
Windows Desktop GUI Apps
This was covered in the prerequisite
course CISP 370.
More to come about what I expect you
all to know in this area.
CISP 371
Chapman
Language Extension
The rest of what VB can do can is
defined within the huge class library
called the .NET Framework.
As the first part of this course we’ll
work with this library.
CISP 371
Chapman
OOP
You will learn how to effectively use the .NET
Framework. You will also extend the .NET
Framework into customized classes using the
OOP concepts of inheritance, polymorphism,
and encapsulation.
These concepts are vital when programming
VB web apps and database connectivity.
CISP 371
Chapman
OOP
You will be able to create advanced memory
storage for your program’s data.
You’ll learn to communicate between modules
with events and exceptions, to organize data
and procedures into classes, to create
expandable array-like objects called
collections, and to save organized data to a
file using serialization.
CISP 371
Chapman
Database Connectivity
The subset of the .NET Framework that
deals with connecting an app to a
database is called ADO.NET.
These classes let you use a database as
a permanent storage area for your
application’s data.
CISP 371
Chapman
Database Connectivity
You can use VB to copy databases into
memory, search the data with VB, edit
the data, and save the data back to the
database.
Working with an existing database with
VB does not require SQL.
CISP 371
Chapman
Windows Web Applications
The subset of the .NET Framework that
deals with connecting an app to a
database is called ASP.NET.
These classes let you create an eventdriven web page that contains controls.
CISP 371
Chapman
Windows Web Applications
You can use VB to build web sites using
the same techniques as building
desktop applications.
CISP 371
Chapman
What You Already Know
This is contained on Blackboard in the
document “CISP 370 topics”.
If you don’t feel comfortable with any
of these topics, plan to meet with me
ASAP during office hours for a quick
tutorial.
CISP 371
Chapman
What You Already Know
Let’s look at two examples
TextBox input data validation
Complicated multiple-window WinApp to
play craps
CISP 371
Chapman
Simple CISP 370 WinApp
This WinApp accepts input in the TextBox and
then validates the input as a positive integer.
If input is invalid, then a MessageBox dialog
informs the user.
CISP 371
Chapman
Simple CISP 370 WinApp
Read the code behind MainForm to see
the
btnProcess_Click() event handler definition
the validation technique using Val() and an
If statement
CISP 371
Chapman
More Complicated WinApp
In the past, the last homework in my CISP
370 asked for a WinApp with three windows
that played the game of craps.
The user could place bets and enable a log
file to keep track of their bets.
The application would determine whether a
bet had won or lost and update the user’s
bankroll.
CISP 371
Chapman
More Complicated WinApp
“GUI sketches” are a method to design
the application before writing a single
line of VB.NET code.
In these sketches the developer
communicates their vision for the
abilities of each window.
CISP 371
Chapman
sketch of window
control names
what user
can do in
window
CISP 371
Chapman
More Complicated WinApp
After the windows have been sketched
out, then the developer writes the code
behind each window.
CISP 371
Chapman
More Complicated WinApp
The main window is always on the screen and is
where the user rolled the dice and managed the
game. The user can navigate to the other windows
and exit the app here.
CISP 371
Chapman
More Complicated WinApp
The bets window allows the user to place a bet prior
to their next roll. The allowable bets depend on the
current state of the game (has the point been set?),
the table minimum bet, and the total amount of
money the user has.
CISP 371
Chapman
More Complicated WinApp
The show-all-bets window displays the currently
placed bets and their amount.
CISP 371
Chapman
What You Don’t Yet Know
How to use .NET Framework classes directly
(instead of having Visual Studio automatically
generate the necessary code).
How to build customized classes that are
based upon the .NET Framework.
How to group code together into a coherent
class that other programmers would find
useful.
CISP 371
Chapman
What You Don’t Yet Know
How to connect your app to a database using
the ADO.NET library.
How to build active web pages using .NET
techniques and the ASP.NET library.
CISP 371
Chapman
My Goal
Students who finish this course have
enough knowledge about using and
expanding the .NET Framework library
to do whatever they like with Visual
Basic.
VB – it’s not just for desktop
applications any more!
CISP 371
Chapman