2. INTERFACES
Interfaces are declared with the following structure
Public Interface <Name of the interface>
:
<decleration of memebrs of the interface, means methods and properties
structure>
:
End Interface
4. HOW USE IN PROGRAMMING
Interfaces are implemented using
Implements keyword.
All the members of the interface are
implemented with Implements keyword.
5. ABSTRACT CLASS VS INTERFACE
Abstract Class Interface
Only one Abstract class can be
inherited into the derived class.
Interfaces enable multiple inheritance
to the object.
Members of the abstract class can or
cannot have implementation.
Interfaces contains only the
definitions for the members without
implementation.
6. WHEN TO USE INTERFACES
The situation at which we need to implement the
functionalities of two or more objects into one
derived object.
It makes the derived object to refer to the
interface methods and properties for syntax
verification.
7. EVENTS
Events are situations at which the message is
sent to an object to signal the occurrence of the
action. These actions can be caused by the user
interaction or within the object itself.
8. EXAMPLE
The class designer can create an event and
raise the same through its methods and
properties. These events will be captured by
the object user and perform his/her required
operation.
9. HOW EVENTS ARE HANDLED
The users create an instance of he Button class
Select the onclick event related to the button
object
Write an action to be performed on click of the
button.
12. FEATURES OF OOPS
Implementing interfaces
Constructors, methods, properties, fields, constants
and events
•Shared constructors
13. STRUCTURE IN VB .NET
Structure Person
Public FirstName As String
Public LastName As String
Public Address As String
Public Pincode As String
Public DateOFBirth As DateTime
Public Sub DisplayInfo()
Dim msg As String
msg = FirstName & " " & LastName & vbCrLf
msg = msg & Address & vbCrLf
msg = msg & "PIN – " & Pincode
msg = msg & "Date of Birth : " & DateOFBirth.ToString
End Sub
End Structure
22. ERROR AND EXCEPTION HANDLING
An Exception is an abnormal/exceptional/unexpected
condition that disrupts the normal execution of an application.
A distinction needs to be made between expected conditions
and unexpected conditions.
23. Error and exception handling are a part and parcel of every good
language, framework class library, or application and should form a
part of your applications too right from the planning stages.
ERROR AND EXCEPTION HANDLING
24. The .NET Framework Class Library (FCL) and Common
Language
Runtime (CLR) provide a rich infrastructure to catch and handle
exceptions.
ERROR AND EXCEPTION HANDLING
26. TRY BLOCK
Enclose a block of code that has
the potential of throwing
exceptions within a try block.
27. CATCH BLOCK
A catch handler associated with the exception that is thrown catches
the exception.
There can be one or more catch handlers and each catch handler
can be associated with a specific exception type that it can handle.
The catch blocks are generally used to gracefully inform the user of
the error and to possibly log the error to a log file or to the system
event log.
29. FINALLY BLOCK
Code within the finally block is
guaranteed to always execute and
usually contains cleanup code.
30.
31.
32.
33. EXAMPLE OF EXCEPTIONS
System.IO.IOException
System.DivideByZeroException
System.ArithmeticException
System.FormatException
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60. REFERENCES
dotNET Tutorial for Beginners, India Community Initiative
Microsoft Visual Studio 2010 by Michael Halvorson, Microsoft
Microsoft Visual Basic 6.0 by Francesco Balena ,Microsoft Press