Upload
donakomeah
View
226
Download
0
Embed Size (px)
Citation preview
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 1/50
Introduction toMicrosoft .NET Framework
ICT316: Advanced Visual Basic
.NET)
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 2/50
Lesson Plan
Introduction and acquaintance
Setting Rules for lecturesData Gathering /Collection
Discussing course structure
Lectures and discussions
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 3/50
Course Details
Course Code: ICT316:
Pre-requisites: Visual Basic Programming
Level 300
Semester/Academic
Year: 2 /January 2011
Credit Hours: 3
Lecturer’s
Information:
Lempogo Forgor
Faculty of informatics
Office: Block A, R. 03
[email protected] Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 4/50
Course Structure
ICT316: Advanced Visual Basic .NET)
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 5/50
Course Description
This course will train the students on Visual Basic programming
and give them an intensive instruction to GUI programming indot Net (.Net) environment through the use of Visual Basic tosolve business problems.
The goal of the course is to build student to be able to apply GUIprogramming to develop organizational software.
The course is a part of the Microsoft Visual Basic .NETcurriculum and is intended to provide Visual Basic programmerswith the skills required to create Windows Forms applications byusing the .NET Framework.
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 6/50
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 eventdriven 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 .NETFramework
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 7/50
Teaching And Learning Methods
Class contact time will comprise of a combination oflecture, discussion and tutorial sessions.
During lectures, students will be required tocontribute by answering questions and contributing toa 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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 8/50
Software Requirement
In class
Microsoft Visual Studio 2008
Personal
Microsoft Visual Studio 2005 – 2010
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 9/50
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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 10/50
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%
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 11/50
Literature And Reading MaterialsTextbook
Rod Stephens “Visual Basic 2008 Programmer’s Reference” - 2008
Additional Optional Reading
Denise Gosnell, Matthew Reynolds and Bill Forgey “Beginning Visual Basic
.NET Database Programming” 2001Bradely 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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 12/50
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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 13/50
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 14/50
Group Project - Description
Write a three to five (3-5) page description of yoursystem, including:
specification
problem statement why you chose the topic,
ERDs, etc.
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 15/50
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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 16/50
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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 17/50
Group Project – Submission Deadline
Completed project together with projectdescription 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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 18/50
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 andassignments from his mates.
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 19/50
Lesson Plan
Lecture and discussions – 2 Hours
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 20/50
Introduction to The Microsoft .NET
Framework
2 Hours
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 21/50
The Microsoft .NET Framework
Lempogo Forgor © 2011. All RightsReserved
The layer that sits between the language (in thiscase, 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 mathcomputations and database access).
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 22/50
The Microsoft .NET Framework cont.
Lempogo Forgor © 2011. All RightsReserved
The .NET Framework is the next iteration ofMicrosoft's platform for developing component-basedsoftware.
It provides fundamental advances in runtime servicesfor application software.
It also supports development of applications that can be free of dependencies on hardware, operatingsystem, and language compiler.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 23/50
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.NETA new web server paradigm.
A new focus on distributed-application architecture
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 24/50
Lempogo Forgor © 2011. All RightsReserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 25/50
The Common Language Runtime (CLR)
Lempogo Forgor © 2011. All RightsReserved
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.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 26/50
Lempogo Forgor © 2011. All RightsReserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 27/50
The CLR
Lempogo Forgor © 2011. All RightsReserved
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 programwith 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.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 28/50
.NET Framework class library
Lempogo Forgor © 2011. All RightsReserved
With .NET, the way operating system services areinvoked is uniform across all languages. -including code embedded in ASP.NET pages.
The .NET classes contain the tools that let you performall kinds of tasks
from writing to a database to reading from a web page.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 29/50
NET Framework class library.
Lempogo Forgor © 2011. All RightsReserved
.NET Framework class library is an integrated classlibrary as a supremely well organized programmingtoolbox.
In the past, these capabilities either were hard-coded into the language with special functions, or
provided through separate components.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 30/50
Lempogo Forgor © 2011. All RightsReserved
ASP NET
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 31/50
ASP.NET
Lempogo Forgor © 2011. All RightsReserved
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 thaninterpreted, greatly increasing execution speed.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 32/50
Web services.
Lempogo Forgor © 2011. All RightsReserved
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 theInternet in mind.
ADO.NET classes provide sophisticated XML capabilities,further increasing their usefulness in a distributed environment.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 33/50
The Bottom Line
Lempogo Forgor © 2011. All RightsReserved
Within .NET, each programming language still has its own
syntax.
For example:
every line in a C# program ends with a semicolon (;), unlike VisualBasic.
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 Windowsmessage box to retrieving a file from the Internet.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 34/50
Examples
Lempogo Forgor © 2011. All RightsReserved
Private Sub CreateTextBox()' This function makes a new text box,' and puts some text in it.Dim MyText As New Textbox()MyText.Location = NewPoint(25,25)MyText.Size = New Size(25,125)MyText.Text = "This was made inVB!"
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 = newPoint(25,25);MyText.Text = "I come from
C#...";this.Controls.Add(MyText);}
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 35/50
What Is Visual Basic .NET?
Lempogo Forgor © 2011. All RightsReserved
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 willrecognize 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 classesInherits keyword for object inheritance,
Visual Basic 6 code cannot be compiled by the Visual Basic .NET compiler without significantmodification.
Microsoft has provided a migration tool to handle the task (mostly, anyway).
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 36/50
Visual Basic .NET - HISTORY
Lempogo Forgor © 2011. AllRights Reserved
Visual Basic is from Basic.
BASIC
Beginners All-purpose Symbolic Instruction Code
a programming language used more than 20 years agoas part of MS-DOS.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 37/50
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, version5.0 in 1997, version 6.0 in 1998.
VB.NET, initially released in February 2002, was not backward compatible with the earlier versions ofVisual Basic.
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 38/50
What Is Visual Basic . NET?
Lempogo Forgor © 2011. AllRights 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 (VB8) 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 theWindows operating system.
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 39/50
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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 40/50
Visual Studio (continued)
Application: program or suite of programs
Windows-based application:
Has a Windows user interfaceRuns on a desktop computer
User interface: what the user sees and interactswith when using an application
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 41/50
Microsoft Intermediate Language
.NET language compilers translate program statements into a
Microsoft Intermediate Language, also called IntermediateLanguage (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 .NETlanguage was used to create it
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 42/50
MIL – cont.d
Lempogo Forgor © 2011. All Rights Reserved
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 43/50
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 44/50
Visual Basic.NET and VB 6: Data Types
True is now = 1Integer 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
S
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 45/50
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 StringEnd Type
Structure Customer
Public CustomerNumber as IntegerPublic CustomerName As String
Public CustomerCompany As String
End Structure
VB NET Zero Bo nd Arra s
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 46/50
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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 47/50
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”
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 48/50
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 49/50
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
8/12/2019 Introduction Vb .Net
http://slidepdf.com/reader/full/introduction-vb-net 50/50