Department of computer
science
Event Driven Programming
1 1
Course contents
Chapter One Introduction Chapter 3: Object-Oriented Fundamentals
in VB.NET
Introduction to Software Development
Language Fundamentals
Software Development Approaches Variables and Data Types
Control Flow
Rapid Application Development Methods and Their Types
Classes and Objects
Software Development Principles
Inheritance and Overloading Implementation
Chapter 2: Introduction to .NET Classes versus Components
The .NET Platform and Its Architecture Chapter 4: Exception Handling
Base Class Library Introducing Exception Handling
Common Language Runtime
Structured Exception Handling
Uses of .NET Platform in Application Development
Implementing Exception Handling
Introduction to Microsoft Visual Studio 2010
SDI and MDI Forms
Controls
2 Events
Cont..
Chapter 5: Manipulating Files How Chapter 6: Database Programming
The ADO.NET Architecture
to open a Text File
LINQ Architecture
Read a file line by line in VB .NET
The .NET Data providers
Write to a Text File
Working with the common .NET Data providers
How to Copy, Move and Delete a File The Dataset Component
Using the DataGrid View for database access
3
Assessment Methods
Assignment/quizzes 10 %
Mid Semester Examination 20%
Project 20%
Final Examination 50%
4
Reference
Text books and References:
1. An introduction to programming using visual basic 6.0, fourth edition, David I.
Schneider Evjen, B et al, (2008). Professional Visual Basic 2008.
2. Crosspoint Boulevard: Wiley Publishing Inc. Gary Cornell and Jonathan Morrison
(2002).
3. Programming VB.NET: A Guide for Experienced Programmers. USA: APress
Cameron Wakefield, Henk-Evert Sonder and Wei Meng Lee. VB.NET Developers
Guide. USA: Syngress Publishing, Inc
5
Chapter One
Introduction
6
Chapter Content
Introduction
Introduction to Software Development
Software Development Approaches
Rapid Application Development
Software Development Principles
7
1.1 Event Driven Programming
Event-driven programming focuses on events
Event-driven programming is a paradigm where entities
(objects, services, and so on) communicate indirectly by
sending messages to one another through an intermediary.
Event:
A signal to the program that something has happened.
8
Cont..
It can be triggered either by external user actions, such as
mouse movements
button clicks, and keystrokes,
by the operating system, such as a timer.
The program can choose to respond to or ignore an event.
9
1.2 Introduction to Software Development
What is the introduction of software development?
Software development is the process of
conceiving, specifying, designing, programming, documenting, testing,
and bug fixing involved in creating and maintaining applications,
frameworks, or other software components.
10
Cont..
Software development is the process programmers use to build
computer programs.
The process, also known as the
Software Development Life Cycle (SDLC),
includes several phases that provide a method for building products
that meet technical specifications and user requirements.
11
1.2.1 Software Development Process
The process vary in the detail of what activities they prescribe,
their related artefacts.(b/c there are many approaches)
However the most common process is
Analysis
Design
Implementation
Testing
Deployment
12
1.3 Software Development Approaches
the most commonly used software development approaches are
• Waterfall Approach
• Spiral Approach
• RAD
• Agile
• Incremental
• Etc…
13
•Waterfall Approach
• The stages of a project
were carried
out sequentially.
• The entirety of each
stage had to be
completed, formally
documented, discussed,
agreed, and signed off
before the next stage
could begin.
• This has been described
as the waterfall
lifecycle.
14
•Spiral Approach
• is a development method that uses
the same steps as the waterfall
method, but also uses project
cycles, each culminating in a version
of the software (a prototype) that is
formally reviewed to inform the next
cycle.
Determine objectives
Identify and resolve risks
Develop and test
Plan (the next iteration)
15
Reading Assignment
Incremental approach
Agile Approach
Extreme programming
DevOps Methodology
Joint Application Development Methodology
16
1.4 Rapid application development
is a development model prioritizes rapid prototyping and
quick feedback over long drawn out development and testing
cycles.
With rapid application development, developers can make
multiple iterations and updates to a software rapidly without
needing to start a development schedule from scratch each
time.
17
Steps in RAD
Although RAD has changed over the years, these four basic
steps provide some continuity over the years.
1. Define the requirements
2. Prototype -> the actual development takes place.
Instead of following a strict set of requirements
3. Receive Feedback
Feedback on what’s good, what’s not, what works, and
what doesn’t
4. Finalize Software
18
19
Cont..
Advantages of the RAD model
helps to reduce the risk and required efforts on the part of
the software developer.
helps the clients to take quick reviews for the project.
Encourages customer feedback which always provides
improvement scope for any software development project.
Each phase in RAD delivers the highest priority functionality
to the client.
20
Cont..
Disadvantages RAD model
Depends on the strong team and individual performances for clearly
identifying the exact requirement of the business.
This approach demands highly skilled developers and a designer’s team
which may not be possible for every organization.
This is not applicable for the developer to use in small budget projects as
the cost of modeling and automated code generation is very high.
Progress and problems accustomed are hard to track as such there is no
documentation to demonstrate what has been done.
21
22
Chapter Two
Introduction to .NET
23
Chapter Content
Chapter 2: Introduction to .NET
The .NET Platform and Its Architecture
Common Language Runtime
Base Class Library
Uses of .NET Platform in Application
Development
Introduction to Microsoft Visual Studio 2010
24
What is .NET Framework?
.Net Framework is a software development platform developed by Microsoft
for building and running Windows applications.
The .Net framework consists of developer tools, programming languages,
and libraries to build desktop and web applications.
It is also used to build websites, web services, and games.
The .Net framework was meant to create applications, which would run on the
Windows Platform.
The first version of the .Net framework was released in the year 2002.
The version was called .Net framework 1.0.
25
Cont.…
.NET Framework Architecture is a programming model for the .Net
platform that provides an execution environment and integration
Has various programming languages for simple development and
deployment of various Windows and desktop applications.
It consists of class libraries and reusable components.
26
.NET Components
Common Language Runtime
CLR is the execution engine that handles running
applications.
It provides services like thread management, garbage
collection, type-safety, exception handling, and more.
also knows as the runtime.
CLR’s responsibility is to mange any code written in .NET
languages such as C#, VB.NET, or F#.
27
Base Class Library(BCL)
The Class Library provides a set of APIs and types for common
functionality.
It provides types for strings, dates, numbers, etc.
The Class Library includes APIs for reading and writing files,
connecting to databases, drawing, and more.
The .NET Framework includes a set of standard class libraries.
A class library is a collection of methods and functions that can be
used for the core purpose.
28
Characteristics of .NET Frame work
29
Uses of .NET Platform in Application Development
Can be used to develop
Windows applications (windows forms)
Web (Asp.net)
Mobile applications that run .NET
Ado.net For Data base connectivity
30
.NET Programming languages?
Supports he following Languages
Visual Basic
C#
F#
Visual C++
Etc.…
31
1.5 Visual Basic programming language
VB.NET is also known as Visual Basic.NET.
It stands for Visual Basic .Network Enabled Technologies.
VB.NET is a simple, multi-paradigm object-oriented
programming language designed to create a wide range of
Windows,
Web,
Mobile applications built on the .NET Framework.
developed by Microsoft in 2002.
32
VB.NET Features
• It is an object-oriented programming language
• This language is used to design user interfaces for window,
mobile, and web-based applications.
• It supports a rapid application development tool kit.
• It is not a case sensitive language like other languages such as
C++, java, etc.
• It provides simple events management in .NET application.
• A Window Form enables us to inherit all existing functionality of
form that can be used to create a new form. So, in this way, it
reduced the code complexity.
33
Advantages of VB.NET
• Your code will be formatted automatically.
• You will use object-oriented constructs to create an
enterprise-class code.
• You can create web applications with modern
features like performance counters, event logs, and
file system.
• You can connect your applications to other
applications created in languages that run on the
.NET framework.
• You will enjoy features like docking, automatic
control anchoring, and in-place menu editor all good
for developing web applications.
34
Disadvantages of VB.NET
• VB.NET cannot handle pointers directly.
• This is a significant disadvantage since pointers are
much necessary for programming.
• Any additional coding will lead to many CPU cycles,
requiring more processing time.
• Your application will become slow.
35
Summary:
• VB.NET was developed by Microsoft.
• It is an object-oriented language.
• The language is not case sensitive.
• VB.NET programs run on the .NET framework.
• In VB.NET, the garbage collection process has been automated.
• The language provides windows forms from which you can inherit your
own forms.
• VB.NET allows you to enjoy the drag and drop feature when creating a
user interface.
36
Introduction to Microsoft Visual Studio 2010
37
38
Solution explorer
Windows Form
Tool box
• button
• Textbox etc
Properties
Data source DB
39
SDI and MDI Forms
40
Add controls to a Blank window form
The first thing we’ll do is to add a button to the blank form. We’ll then
write a single line of code, so that you can see how things work.
Tool box
The tool box contains all the necessary controls
If you want to add a control to a form, you can use the Toolbox on the left of Visual Studio. Move
your mouse over to the Toolbox, and click the arrow symbol (or plus symbol) next to Common
Controls.You should see the following list of things that you can add to your form:
41
42
Button Control
The button control represents a standard windows button .
It is generally used to generate a click events by providing a handler for
the click event
43
Button Control
The button control represents a standard windows button .
It is generally used to generate a click events by providing a handler for
the click event
44
Adding Button controls to a window form
45
Event associated with Button
Event
An event is an member of a class, used to perform required action
Event is similar to function but pointed by a delegate or function
pointer
Every event will have particular period of time that is to be called as
event raising/firing
Delegate are completely backbone for the event
46
Label Control
The label control is one of the most commonly used windows form
It is generated used to display the text that is not supposed to be changed by
the user at run time
47
TextBox Control
This control is used to accept the data from the user and also to display the
data dynamically to the user
48
RadioButton Control
This control is used to provide selection of only one option from the
given group of option
The RadioButton control can display text an image or both
49
CheekBox Control
This control is used to provide selection of more than one option from
the given group of option
The CheekBox control can display text, an image or both
50
ListBox Control
This control is used to display group of items to user so that users can select
a single item or group of item randomly or range of items
51
comboBox Control
Combo box is the combination of both textbox and listbox
In combo box control, user can enter the data at run time and also we can
display group of items to the user
52
Events
Events are basically a user action like key press, clicks, mouse movements, etc., or
some occurrence like system generated notifications. Applications need to respond
to events when they occur.
Clicking on a button, or entering some text in a text box, or clicking on a menu item,
all are examples of events. An event is an action that calls a function or may cause
another event. Event handlers are functions that tell how to respond to an event.
VB.Net is an event-driven language. There are mainly two types of events −
Mouse events
This event gets triggered when the pointer of the mouse enters the control.
Keyboard events
These are the events that are triggered when the events are fired upon any action done on the keyboard. This
includes actions such as keypress, keydown, enter, etc. Let us study some of the keyboard-based events in detail.
53
To be continued in Lab……
54
55
Chapter 3:
Object-Oriented Fundamentals in VB.NET
56