VBNotes
VBNotes
VBNotes
Net
Studio .Net
The Start Page
Problems with Studio .Net in the lab
environment
Studio .Net
All present .Net languages are included under one
development environment
When using any one of the languages, the studio must be
used (there is no longer an environment for each
language)
You have to start a new solution/project
Projects are containers that contain the files associated with
a particular project
A solution is a container that contains one or more projects
or project containers
When the IDE is started you have the Projects tab,
online resources, and My Profile
The Start Page
Profile and
environment settings
Tab for
Tab for Additional Help
this view
Previous Projects
Open a project
Start a new
in a diff. location
project
Problems with Studio .Net
environment in the lab
.Net security must allow access to the J: drive or
the local intra net in order to work properly
Problems arise when debugging apps on an ASP
.Net server that is not part of the current domain
(CLC) Basic apps will still work fine
These problems are not present if IIS and remote
debugging tools are installed on the client machine
This solution is fine for students but is not practical for a
lab
Due to security holes of IIS you can have hundreds of
security risks on a given network.
In the Real world situation, all apps will be placed on a
server anyway
Visual Basic .Net
General Features
Additional Features of VB .Net
What has changed in VB .Net
General features
It is an object oriented language
Students do better with this subject when they have a firm understanding of objects
In the past VB had objects but focus was not placed on them
VB .Net use objects and inheritance with everything
Uses exception handling extensively
New techniques are shown to the student for providing feedback from their
programs in order to help trouble shoot errors
Like with most OOP languages, exceptions that are not handled will cause programs
to abnormally end or exit
Uses generics with creating classes and Sub programs
Can use the top data type on inheritance of type Object
Used for late binding of data types and is quite useful when implementing stacks or
queues of any data type (.Net 2.0)
Provides a quick way to develop heavy duty applications in a windowing
environment
It is a useful tool for developing event driven programs
Additional Feature of VB
.Net
Can create both windows applications and web applications at
the click of a mouse button
The interface between the Databases and applications
Are the same between web apps and windows apps
All data are transferred between the apps in XML format
regardless if it is a web application or a windows application
A copy of the data from the database is loaded into a data set.
Persistent connections between the application and the database
no longer exists
Every form is a class and new forms now have to be
instantiated
VB .Net is still not case sensitive
What is Not in VB .Net
Data Controls
Because of the different way that the apps connect to the
database, there is no longer the support of data controls
in VB .Net
Persistent connections with the database is no longer
present
Object instantiation is now done differently
Garbage collection for references that lose there
objects are done periodically not when the
reference lose its scope
Periodic changes throughout the language making
it vastly different from VB 6.0 in order to make it
compliant to the .Net Framework and the CLS
The Introduction to
VB .Net
Data Types in VB .Net
Functions and Sub Procedures
Practice Examples
Data Types in VB .Net
Data Types and possible values
Integer -> -2,147,483,648 (4 bytes)
Double -> floating point numbers with 14 digits of accuracy
(8
Bytes)
Decimal -> decimal values ( 16 bytes replaced currency in 6.0)
Date -> the date (8 Bytes)
Byte -> 0 to 255 (1 Byte)
Char -> Unicode character (2 Bytes)
Boolean ->True or false value (2 Bytes)
Single -> floating point number with 6 digits of accuracy (4 bytes)
Short -> 2 byte integer
Long -> 8 byte integer
String -> an arrangement of alpha-numeric characters varies in
length
Object -> any data type 4 bytes
Functions and Sub
procedures / Programs in
VB .Net (Methods)
Functions and sub procedures must either have a sub or
function keyword in the function or sub procedure heading
They can be either public or private (following the same
conventions in OOP languages such as C++ or Java)
All parameters are passed by value by default in VB .Net
Parameters of any data type may be passed by reference
All Objects and arrays are passed by reference not value
All events are handled by a sub procedure in VB .Net
Functions return a value and Sub Procedures do Not
Practice example 1
You can use the text book given to you to
get the basics needed in programming VB
starting on page 477
Getting familiar with VB .Net
Write a program that will take text from one text
box and place that text in another text box with
a click of a button
Take a look at the attributes of each control
A control can be a button text box etc.
Each control should contain names that follow VB
specifications i.e. txtBox1 txtBox2 btnMove
Each name as always should be meaningfull
Practice Example 2
June 8, 2004
Microsoft SQL Server
MS SQL Basics
The Enterprise Manager
Creating Databases
Connecting to Databases
The use of the Data Set
Exception Handling
Microsoft SQL Basics
Each container
has a specific
role
Student
Databases are
in the
databases
container
Database Container
Every students
database is displayed
Only the database that
the student has
permissions for can be
opened
Click on the database
container with your
username
Student Database
container
Creating the Database
Creating tables
Properties of the data types
Entering and Displaying Data in
database Tables
Creating Tables
June 9, 2004
Topics
Adding and Editing Records
Updates and deletes with Bound controls
Classes and Modules in VB .Net
Menus
From design
MDI (Multi Document Interfaces)
Bound and unbound controls in VB .net
Why Unbound controls are used
Adding and Editing
Records
When Adding records
The Position of the dataset should be set to the
end
The text boxes should be cleared
The AddNew() Method accomplishes all this
in one method call
The AddNew() Method is part of the
BindingManagerBase Object
When changes are being made, a cancel
button should be provided to Roll Back
changes made to the data set
Edit
When Navigating the database the Text
boxes should be disabled to prevent
changes
There should be an edit button that
Disables the navigation button
Enables the text boxes for editing
Provide a cancel button that Roles Back the
changes that are made by calling the
CancelCurrentEdit() method of the
BindingManagerBase Object
Update and Deleting
Records
This is done by
Ending the current edit by calling EndCurrentEdit() in the
BindingManagerBase class
Updating the DB with Update() in the data adapter
Cause the dataset to reflect the changes by calling the
AcceptChanges() method in the data set
Deleting the records
First Ask the user if they are sure they want to delete
Use the RemoveAt() method of the BindingManagerBase
object
Update the database with the Update() method
Have the dataset reflect the change by calling the
AcceptChanges() method of the dataset object
Practice Example 1
Two constructors