Anda di halaman 1dari 50

Introduction to

Microsoft .NET Framework


Lesson Plan
Introduction and acquaintance
Setting Rules for lectures
Data Gathering /Collection
Discussing course structure
Lectures and discussions
Lempogo Forgor 2011. All Rights Reserved
Course Details
Course Code: ICT316:
Pre-requisites: Visual Basic Programming
Level 300
Semester/Academic
Year:
2 /January 2011
Credit Hours: 3
Lecturers
Information:
Lempogo Forgor
Faculty of informatics
Office: Block A, R. 03
forlempo@yahoo.co.nz
Lempogo Forgor 2011. All Rights Reserved
Course Structure
ICT316: Advanced Visual Basic (.NET)
Course Description
This course will train the students on Visual Basic programming
and give them an intensive instruction to GUI programming in
dot Net (.Net) environment through the use of Visual Basic to
solve business problems.
The goal of the course is to build student to be able to apply GUI
programming to develop organizational software.
The course is a part of the Microsoft Visual Basic .NET
curriculum and is intended to provide Visual Basic programmers
with the skills required to create Windows Forms applications by
using the .NET Framework.
Lempogo Forgor 2011. All Rights Reserved
Course Educational Objectives
Upon completion of this course, the student will be able to:
Create Windows applications using a variety of GDI+ features.
Apply concepts of programming data access and web forms.
Implement programming logic and design techniques for event
driven and object oriented programming.
Write applications that are easy for the user to understand and use.
Deploy a Windows application both with and without the .NET
Framework
Lempogo Forgor 2011. All Rights Reserved
Teaching And Learning Methods
Class contact time will comprise of a combination of
lecture, discussion and tutorial sessions.
During lectures, students will be required to
contribute by answering questions and contributing to
a topic on the floor for discussion.
The class will meet for three (3) hours every week
(see Time table).
Lempogo Forgor 2011. All Rights Reserved
Software Requirement
In class
Microsoft Visual Studio 2008
Personal
Microsoft Visual Studio 2005 2010
Lempogo Forgor 2011. All Rights Reserved
Topics And Course Schedule
Lempogo Forgor 2011. All Rights Reserved
Unit Topic Week
Unit 1 Introduction 1
Unit 2
Windows Database Applications
2 -3
Unit 3 Data Access with ADO.NET 4
Unit 4 Windows Database Updates 5
Unit 5 Windows Database Using Related Tables 6 7
Unit 6 Introduction to ASP.NET 8 9
Unit 7 Introduction to XML 10 -11
Unit 8 Deployment issues for desktop applications 12
Course Requirements
Lempogo Forgor 2011. All Rights Reserved
Activity Minimum Percentage
Assignment 5%
Group project 15%
Mid Semester Exams 10%
End Of Semester Exams 70%
Total 100%
Literature And Reading Materials
Textbook
Rod Stephens Visual Basic 2008 Programmers Reference - 2008
Additional Optional Reading
Denise Gosnell, Matthew Reynolds and Bill Forgey Beginning Visual Basic
.NET Database Programming 2001
Bradely and Milspaugh Advanced Programming Using Visual Basic 2005.
McGraw Hill - 2007
Chris Sells, Justin Gehtland Addison Wesley Windows Forms Programming in
Visual Basic.NET - 2003
John Kauffman, Fabio Claudio, Ferracchiat Beginning ASP.NET Databases
using VB.NET - 2002.
Russ Basiura, Mike Batongbacal and others Professional ASP.NET Web Services
with VB.NET - 2002.
Lempogo Forgor 2011. All Rights Reserved
Literature And Reading Materials
WEB Resources
http://msdn.microsoft.com/vbasic/
http://www.mvps.org/vbnet/
http://www.vb-world.net/
http://www.gotdotnet.com/team/vb/
http://vbwire.com/
Lempogo Forgor 2011. All Rights Reserved
Group Project
Put yourselves into groups of threes or fours
Think of a subject area and come up with a project topic
Topic must be on creating a system (VB .NET Application)
to solve a business problem
The application must be base on a relational database not
less them 4 related tables
Database can be created with any DBMS
Lempogo Forgor 2011. All Rights Reserved
Group Project - Description
Write a three to five (3-5) page description of your
system, including:
specification
problem statement
why you chose the topic,
ERDs, etc.
Lempogo Forgor 2011. All Rights Reserved
Group Project - Submission
project must be in a folder called <your ID>
project description will be an MS word document saved
with name <your ID>
both project folder and description must be zipped
together (zipped file must bear your ID)
the zip file will then be submitted
Lempogo Forgor 2011. All Rights Reserved
Group Project E-mail Submission
Attached the zip file created above to an e-mail
Write the following in the subject text box:
<your ID> _VB_Project
Send to my inbox.
NOTE:
Be Sure it ends up in my inbox BEFORE the DEAD
LINE!!
Lempogo Forgor 2011. All Rights Reserved
Group Project Submission Deadline
Completed project together with project
description must be submitted by the 31
of March 2011 (11:00 PM GMT):
in Person(in my OFFICE) or
by e-mail.
Lempogo Forgor 2011. All Rights Reserved
Course Requirements And Policies
Class Participation:
Preparation and engaged participation at all class sessions are expected of
all students.
Deadlines are sacred and firm.
Failure to keep deadlines will adversely affect your grade.
Attendance:
regular attendance and promptness are expected at each lecture.
When absent from class, the student is responsible for getting notes and
assignments from his mates.
Lempogo Forgor 2011. All Rights Reserved
Lesson Plan
Lecture and discussions 2 Hours
Lempogo Forgor 2011. All Rights Reserved
Introduction to The Microsoft .NET
Framework
2 Hours
Lempogo Forgor 2011. All Rights Reserved
The Microsoft .NET Framework
Lempogo Forgor 2011. All Rights
Reserved
The layer that sits between the language (in this
case, Visual Basic) and the operating system.
The .NET Framework layer serves to provide:
functionality based on the operation of the Windows
system on which it resides
libraries for other functionality (such as math
computations and database access).
The Microsoft .NET Framework cont.
Lempogo Forgor 2011. All Rights
Reserved
The .NET Framework is the next iteration of
Microsoft's platform for developing component-based
software.
It provides fundamental advances in runtime services
for application software.
It also supports development of applications that can
be free of dependencies on hardware, operating
system, and language compiler.
Components of .NET Framework
Lempogo Forgor 2011. All Rights Reserved
The .NET Framework encompasses the following:
The Common Language Runtime (CLR)
A new infrastructure for managing application execution.
.NET Framework class library
A new way to expose operating system and other APIs.
ASP.NET
A new web server paradigm.
A new focus on distributed-application architecture
Lempogo Forgor 2011. All Rights
Reserved
The Common Language Runtime (CLR)
Lempogo Forgor 2011. All Rights
Reserved
The CLR is a runtime environment that processes,
executes, and manages Visual Basic code.
The CLR includes:
The Common Type System (CTS)
for cross-language type compatibility
The Common Language Specification (CLS)
for ensuring that third-party libraries can be used from all
.NET-enabled languages.
Lempogo Forgor 2011. All Rights
Reserved
The CLR
Lempogo Forgor 2011. All Rights
Reserved
It prevents operations that could corrupt memory and
cause the system to become unstable.
It automatically cleans up objects you do not need.
It catches common mistakes and halts your program
with an error, rather than letting it run on with
scrambled data.
It compiles your code on the fly into native machine
code, ensuring optimum performance.
.NET Framework class library
Lempogo Forgor 2011. All Rights
Reserved
With .NET, the way operating system services are
invoked is uniform across all languages.
-including code embedded in ASP.NET pages.
The .NET classes contain the tools that let you perform
all kinds of tasks
from writing to a database to reading from a web page.
.NET Framework class library.
Lempogo Forgor 2011. All Rights
Reserved
.NET Framework class library is an integrated class
library as a supremely well organized programming
toolbox.
In the past, these capabilities either were hard-
coded into the language with special functions, or
provided through separate components.
Lempogo Forgor 2011. All Rights
Reserved
ASP.NET
Lempogo Forgor 2011. All Rights
Reserved
Microsoft has replaced its Active Server Pages (ASP)
technology with ASP.NET.
The classic ASP is familiar with ASP.NET on the surface
but the underlying engine is different,
Far more features are supported ASP.NET .
ASP.NET web page code is compiled rather than
interpreted, greatly increasing execution speed.
Web services.
Lempogo Forgor 2011. All Rights
Reserved
Visual Studio .NET provides great tools for creating and
consuming web services
- vendor-independent software services that can be
invoked over the Internet.
The .NET Framework is designed top to bottom with the
Internet in mind.
ADO.NET classes provide sophisticated XML capabilities,
further increasing their usefulness in a distributed environment.
The Bottom Line
Lempogo Forgor 2011. All Rights
Reserved
Within .NET, each programming language still has its own
syntax.
For example:
every line in a C# program ends with a semicolon (;), unlike Visual
Basic.
But these differences are really just superficial.
Every .NET language is built on the CLR.
All .NET languages share a common set of class libraries,
which they use to do everything from displaying a Windows
message box to retrieving a file from the Internet.
Examples
Lempogo Forgor 2011. All Rights
Reserved
Private Sub CreateTextBox()
' This function makes a new text box,
' and puts some text in it.
Dim MyText As New Textbox()
MyText.Location = New
Point(25,25)
MyText.Size = New Size(25,125)
MyText.Text = "This was made in
VB!"
Me.Controls.Add(MyText)
End Sub
Here is the VB 2005 version:
private void CreateTextBox()
{
// This function makes a new text box,
// and puts some text in it.
Textbox MyText = new Textbox();
MyText.Size = new Size(25,125);
MyText.Location = new
Point(25,25);
MyText.Text = "I come from
C#...";
this.Controls.Add(MyText);
}
What Is Visual Basic .NET?
Lempogo Forgor 2011. All Rights
Reserved
Visual Basic .NET is the next generation of Visual Basic, but it is also a significant departure from
previous generations.
Experienced Visual Basic 6 developers will feel comfortable with Visual Basic .NET code and will
recognize most of its constructs.
Microsoft has made some changes to make Visual Basic .NET a better language and an equal player in
the .NET world.
Class keyword for defining classes
Inherits keyword for object inheritance,
Visual Basic 6 code cannot be compiled by the Visual Basic .NET compiler without significant
modification.
Microsoft has provided a migration tool to handle the task (mostly, anyway).
Visual Basic .NET - HISTORY
Lempogo Forgor 2011. All
Rights Reserved
Visual Basic is from Basic.
BASIC
Beginners All-purpose Symbolic Instruction Code
a programming language used more than 20 years ago
as part of MS-DOS.
The Versions of Visual Basic
Visual Basic 1.0 first appeared in 1991.
It was followed by version 2.0 in 1992,
version 3.0 in 1993, version 4.0 in 1995, version
5.0 in 1997, version 6.0 in 1998.
VB.NET, initially released in February 2002, was not
backward compatible with the earlier versions of
Visual Basic.
Lempogo Forgor 2011. All Rights Reserved
What Is Visual Basic . NET?
Lempogo Forgor 2011. All
Rights Reserved
Visual Basic has gone through a few revisions since VB 6.
VB 2002 (a.k.a. VB 7), VB 2003 (VB 7.1), VB 2005 (VB
8) VB 2008, etc. are all just revisions of the language as
it uses the .NET Framework.
In Visual Basic 2008, you have a new way to build user
experiences and, with it, a new way to interact with the
Windows operating system.
Visual Studio
Integrated Development Environment (IDE):
Contains all the tools and features needed to create, run,
and test programs
Includes an editor and compiler
Visual Studio:
IDE used to create Windows or Web-based programs
Includes Visual Basic, Visual C++, Visual C#, and Visual
J#
Lempogo Forgor 2011. All Rights Reserved
Visual Studio (continued)
Application: program or suite of programs
Windows-based application:
Has a Windows user interface
Runs on a desktop computer
User interface: what the user sees and interacts
with when using an application
Lempogo Forgor 2011. All Rights Reserved
Microsoft Intermediate Language
.NET language compilers translate program statements into a
Microsoft Intermediate Language, also called Intermediate
Language (IL)
Common Language Runtime Manages the execution of IL
instructions
Just-in-time (JIT) compiler: translates IL into machine code
CLR allows compiled IL to be reused, regardless of which .NET
language was used to create it
Lempogo Forgor 2011. All Rights Reserved
MIL cont.d
Lempogo Forgor 2011. All Rights Reserved
Visual Basic.NET and VB 6: Data Types
True is now = 1
Integer Data type has changed
Short (Int16), Integer (Int32), Long (Int64)
VB 6
VB.NET
Dim intAge As Integer
Dim intID As Long
Dim intAge As Short
Dim intID As Integer
VB.NET: Type vs. Structure
Defining user defined types (UDT) has a new syntax
VB 6
VB.NET
Type Customer
CustomerNumber as Long
CustomerName As String
CustomerCompany As String
End Type
Structure Customer
Public CustomerNumber as Integer
Public CustomerName As String
Public CustomerCompany As String
End Structure
VB.NET: Zero Bound Arrays
Option Base 1|0 has been removed
All arrays are base 0
The following declaration has 5 elements,
arrElements(0) through arrElements(4)
Dim arrElements(5) As String
VB.NET: Default Properties
Default properties are no longer supported.
Important! Early Binding is key in VB6
VB 6
VB.NET
txtAddress = rs(Addr_1)
lblFName = First Name
txtAddress.Text = rs(Addr_1).value
lblFName.Text = First Name
VB.NET: New Declaration Syntax
Variables can now be declared and initialized on
declaration line.
VB 6
VB.NET
Dim intLoop As Integer
intLoop = 10
Dim intLoop As Integer = 10
VB.NET: Structured Exception Handling
VB.NET supports elegant error handling
VB 6
VB.NET
On Error Goto ErrTag
...
clean up
Exit Function
ErrTag:
error handling
clean up
End Function
Try
...
Catch
error handling
Finally
clean up
End Try
Any Questions
Lempogo Forgor 2011. All Rights Reserved