expandable array-like objects called collections, and to save organized data to a file using serialization... Database ConnectivityThe subset of the .NET Framework that deals with connec
Trang 1Intermediate Visual Basic
CISP 371
CRC
Prof Chapman
Trang 2VB 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
Trang 4VB Capabilities
VB can handle
Windows desktop GUI applications
Windows web applications
Database connectivity
Extension of the language
OOP
Trang 5Windows 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
Trang 6Language 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
Trang 7These concepts are vital when programming
VB web apps and database connectivity.
Trang 8expandable array-like objects called
collections, and to save organized data to a file using serialization.
Trang 9Database 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
Trang 10Database 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
Trang 11Windows 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
event-driven web page that contains controls
Trang 12Windows Web Applications
You can use VB to build web sites using the same techniques as building
desktop applications
Trang 13What 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
Trang 14What You Already Know
Let’s look at two examples
TextBox input data validation
Complicated multiple-window WinApp to play craps
Trang 15Simple 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.
Trang 16Simple 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
Trang 17More 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
Trang 18More 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
Trang 19sketch of window
control names
what user
Trang 20More Complicated WinApp
After the windows have been sketched out, then the developer writes the code behind each window
Trang 21More 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.
Trang 22More 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.
Trang 23More Complicated WinApp
The show-all-bets window displays the currently placed bets and their amount.
Trang 24What 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
Trang 25What 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.
Trang 26My 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