SlideShare une entreprise Scribd logo
1  sur  34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Objectives
In this lesson, you will learn to:
Identify the different types of procedures in Visual
Basic .NET
Identify the importance of procedure overloading
Identify the importance of procedure overriding
Implement the MsgBox( ) function
Implement the CommonDialog classes




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 1 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Procedures
Are sets of one or more program statements that can be
executed by referring to the procedure name.
Are the key to modular programming. They simplify the task
 of maintaining and debugging the application code.
Are useful for performing repetitive tasks, such as fetching
 specific records from a database, and text and control
manipulation.
Are of three types:
         Sub procedures
         Function procedures
         Property procedures
©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 2 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Sub Procedure
Is a block of code enclosed within the Sub and End Sub
statements.
Does not return a value. However, it can take arguments,
     such as constants, variables, and expressions that are
     passed to it by the calling code.
        Example
     Public Sub Check_Acct_Status (ByVal
CustAcct  As Integer, ByVal Amount As Single)
        ’The statements of the Sub procedure are
        given here.
        End Sub

©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 3 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Sub Procedure (Contd.)
 Can be defined in a module, a class, or a structure.
 Can be created with one of the following access modifiers:
         Public
         Protected
         Friend
         Protected Friend
         Private




©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 4 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Sub Procedure (Contd.)
 Can take arguments. You declare each argument by
  specifying the argument name and the data type.
 Can have an optional argument. An optional argument
  must be declared at the end of the argument list and must
  have a default value.
 Can be called by using the Call keyword and providing
  values for all the arguments that are not optional. You can
  pass arguments to a sub procedure either by value or by
  reference.
 Can be further categorized as:
         General procedures
         Event-handling procedures
©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 5 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Sub Procedure (Contd.)
 General procedure
         Is a block of code that performs a specific task.
 Event-handling procedure
         Is a block of code that is executed when a specific
          event occurs, such as the click of a button or the
          loading of a form in the memory.
         Is a combination of the object name and the type of
          event that has occurred.




©NIIT       Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 6 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Function Procedure
Is a block of code enclosed within the Function and End
 Function statements.
Returns a value to the calling code.
   Example
  Public Function Check_Acct_Status (ByVal
CustAcct As Integer, ByVal Amount As Single)
  As Integer
       ' The statements of the Sub procedure
   are given here.
    Return Amount
   End Function
©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 7 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Function Procedure (Contd.)
 Can be defined in a module, a class, or a structure.
 Can be created with one of the following access modifiers:
         Public, Protected, Friend, Protected Friend,
          and Private.
 Has Public access by default.
 Uses the Return statement to return a value to the calling
  procedure.
 Return value can be trapped by calling a function and
  assigning the return value of the function to a variable.
   Example
   TotalAmount =
   Calculate_Amount(Total_Salary,months)
©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 8 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Property Procedure
Is a set of code statements that are used to assign or
retrieve the values of the properties declared within a
module, a class, or a structure.
Is a type of variable that stores the values of an object of a
       class or a structure.
Can help you define a property as read-only, write-only, or
     read/write type.
Is of two types:
         Get procedures are used to retrieve the values from a
          property.
         Set procedures are used to assign values to a property.

©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 9 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Property Procedure (Contd.)
Is always invoked implicitly by the code that refers to the
 property, that is, the code uses the name of the property and
 provides values for all the arguments that are not optional.




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 10 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Passing Arguments to a Procedure
You can pass arguments to a procedure:
         By value using the ByVal keyword
         By reference using the ByRef keyword
In Visual Basic .NET, the default argument passing
 mechanism is ByVal.




©NIIT     Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 11 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Parameter Array
Can be used to pass an array of values for an argument of
     a procedure.
Is defined by using the keyword ParamArray.
Rules:
You cannot use more than one parameter array in a
procedure, and it must be the last argument in the procedure
definition.
The parameter array must be passed by value.
The code within the procedure must use the parameter
array as a one-dimensional array. In addition, each element
       of the array must be of the same data type as the data
type of ParamArray.
©NIIT    Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 12 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Parameter Array (Contd.)
The parameter array is optional. The default value of a
parameter array is an empty one-dimensional array.
The parameter array must be the lone optional argument in
      the list of arguments for a procedure. All other
arguments      preceding the parameter array must be used.




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 13 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Procedure Overloading
 Means defining multiple procedures using the same name
  but different argument lists, also referred to as signature.
 When you overload a procedure:
         Each overloaded version uses the same procedure
          name.
         Each overloaded version differs from all the other
          overloaded versions in one of the following ways:
           ®The number of arguments
           ®The order of the arguments
           ®The data types of the arguments


©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 14 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Procedure Overloading (Contd.)
 You cannot overload a procedure by varying only one or
  more of the following items:
         The procedure modifiers, such as Public, Shared,
          and Static
         The argument names
         The argument modifiers, such as ByRef and Optional
         The data type of the return value




©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 15 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Procedure Overriding
 Means redefining a base class procedure in a derived class
  without changing the name of the procedure. Rules:
         You can override procedures that are declared with the
          Overridable keyword in the base class.
         You need to explicitly declare a procedure in the base
          class with the Overridable keyword in order to
          override it in the derived class.
         Overridden procedures need to have the same
          arguments as the inherited members from the base
          class.
         The redefined implementation of a procedure in the
          derived class can call the implementation defined in the
          parent class by specifying MyBase keyword before the
          procedure name.
©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 16 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Built-in Functions in Visual Basic .NET
                       Functions                                      Usage


        Len (string expression)                      To find the length of the string
                                                     expression that is passed as the
                                                     argument
        Mid (string expression, starting position,   To extract a particular number of
        number of characters)                        characters, starting at a given character
                                                     position, from the string expression that
                                                     is passed as the argument
        CDate (string expression)                    To convert the string expression that is
                                                     passed as the argument to the Date
                                                     type
        CTime (string expression)                    To convert the string expression that is
                                                     passed as the argument to the Time
                                                     type
        Val (string/object/ char expression)         To convert the numbers contained in a
                                                     string/char/object to a numeric value




©NIIT         Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 17 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Built-in Functions in Visual Basic .NET(Contd.)
                       Functions                                   Usage

        CBool (expression)                        To convert a string or numeric expression
                                                  to Boolean values

        CByte (string/numeric expression)         To convert a string or a numeric
                                                  expression to a Byte data type

        CInt (string/numeric expression)          To convert a string or a decimal
                                                  expression to an integer
        CObj (string/numeric expression)          To convert a string or numeric value to an
                                                  object
        CChar (string/numeric expression)         To convert a string or numeric value to a
                                                  Char
        CStr (string/numeric expression)          To convert a string or numeric value to a
                                                  String
        CDec (string/numeric expression)          To convert a string or numeric value to a
                                                  Decimal
        CType(expression.datatype/object/class/   To convert an expression from one type
        structure)                                to another

©NIIT        Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 18 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Problem Statement 4.D.1
The customer data entry forms at the call centers of Diaz
Telecommunications need to include options to check for a
valid customer ID and telephone number. The customer ID
should start with the letter ‘C’ and have three digits after it.
The telephone number should consist of eight digits. The form
should also have the facility to display error messages when
incorrect data is entered. Additionally, the form should have
the provision to clear the last customer details entered.




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 19 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Task List
Identify the checks that need to be applied on the form.
Identify the changes needed in the design of the form.
Identify the mechanism to display error messages.
Add the additional controls to the form.
Check the data and display an error message.
Save the application.
Run the application to validate the checks applied on the
      form.




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 20 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Task 1: Identify the checks that need to be applied on the
form.
Result:
As per the problem statement, the customer data entry form
 needs to have a provision to check for a valid customer id
 and telephone number.
You can add the provision for checking the validity of the
  customer id and the telephone number by including
procedures in the customer data entry application.
Since Visual Basic .NET allows the use of procedure
overloading, you can create two versions of a procedure in
  the customer data entry application to check the validity of
  the customer id and the telephone number.


©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 21 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Task 2: Identify the changes needed in the design of
the form.
You will create an overloaded procedure for checking the
     validity of the customer id and the telephone number.
You can name the procedure Check_data ().
Result:
The following table recommends suitable prefixes that you
      can use for the two buttons:
                   Object               Prefix           Example


              Button              cmd                 cmdCheckdata


              Button              cmd                 cmdReset




©NIIT     Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 22 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Task 3: Identify the mechanism to display error
messages.
Messages can be displayed by using either
         Msgbox ()Function
         MessageBox Class




©NIIT     Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 23 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Task 3: Identify the mechanism to display error
messages. (Contd.)
Result:
To display an error message to users when an invalid
customer id or telephone number is entered in the customers
data entry form, you can use either the    MessageBox
class or the built-in MsgBox()function.
Since MessageBox class offers greater control over the
interface of the message box, such as displaying
appropriate icons, you should use the MessageBox class to
display error message when invalid customer id or telephone
number is entered.



©NIIT     Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 24 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Task 4: Add the additional controls to the form.
Task 5: Check the data and display an error
message.
Task 6: Save the application.
Task 7: Run the application to validate the checks
applied on the form.




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 25 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Problem Statement 4.P.1
The Employee data entry form in the call centers at Diaz
Telecommunications requires options to check for valid
employee ID and age entries. The employee ID should start
with the letter ‘E’ and have three digits after it. The age should
be more than 20 years and less than 61 years. The form
should also have the facility to display error messages when
incorrect data is entered. Additionally, the form should have a
provision to clear the last employee details entered. The
details of an employee essentially include the employee id,
the employee’s first name, the employee’s last name, the
address, the age, the date of joining, the department, and the
salary.



©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 26 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Just a Minute…
2. There are two labels named Label1 and Label2 and one
   button named Button1 on the form, Form1. Predict the
   output of the code, when Button1 is clicked at run time.
3. There are two labels named Label1 and Label2 and one
   button named Button1 on the form, Form1. You have
   created a user-defined Sub procedure called MySub to
   process information when the user clicks Button1. Predict
   the output of the code, when the program is executed.
4. There is one label named Label1 and one button named
   Button1 on the form, Form1. What will be the output of the
   code when Button1 is clicked at run time?



©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 27 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Common Dialog Classes
Are used to access the default Font dialog box to change
 the font of the text or used to open a file by using the Open
 dialog box and display the contents.
Are of the following types:
         ColorDialog
         FontDialog
         FileDialog
         PrintDialog
         PageSetupDialog



©NIIT     Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 28 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
ColorDialog Class
Is used to change the background and the foreground color
 of text.
FontDialog Class
Is used to change the font, the font style, and the size of
 text.
FileDialog Class
Is an abstract class that is inherited from the
 CommonDialog class.
You cannot instantiate it directly. However, you can use the
 OpenFileDialog or SaveFileDialog class to open a file
 or save an existing file.

©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 29 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
PrintDialog Class
 Is used to print text or graphics.

PageSetupDialog Class
 Used to set the page details for printing in Windows
  applications.




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 30 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Just a Minute…
2. What will be the output of the code when Button1 is clicked
   at run time?
3. The code snippet is written in the Code Editor window of
   Form1. While building the project, there was a build error.
   What would you do to resolve the error?




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 31 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Summary
In this lesson, you learned that:
A procedure is a set of one or more program statements
that can be executed by referring to the procedure name.
Procedures are of three types:
         Sub
         Function
         Property
Sub procedures can be of two types:
         General
         Event-handling
©NIIT     Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 32 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Summary (Contd.)
 Property procedure is of two types:
         Get procedures are used to retrieve values from a
          property.
         Set procedures are used to assign values to a property.
 Property procedures are used to access properties declared
  within a module, a class, or a structure.
 Arguments can be passed to a procedure either by value or
  by reference.
 Parameter arrays enable you to pass an array of values as
  an argument to a procedure.
 Procedure overloading is defining multiple procedures
  having the same name but different argument lists.

©NIIT      Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 33 of 34
Introducing Procedures and CommonDialog Classes
in Visual Basic .NET
Summary (Contd.)
 Procedure overriding enables you to redefine a base class
  procedure in a derived class without changing the name of
  the procedure.
 The CommonDialog class is the base class for the most
  commonly used dialog boxes, such as, Font, File, Print, and
  Page Setup.




©NIIT   Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 34 of 34

Contenu connexe

Tendances

Programming in c++
Programming in c++Programming in c++
Programming in c++
Baljit Saini
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
jigeno
 

Tendances (20)

Java sessionnotes
Java sessionnotesJava sessionnotes
Java sessionnotes
 
Delphi qa
Delphi qaDelphi qa
Delphi qa
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Lecture 8 abstract class and interface
Lecture   8 abstract class and interfaceLecture   8 abstract class and interface
Lecture 8 abstract class and interface
 
Intervies
InterviesIntervies
Intervies
 
Java interface
Java interfaceJava interface
Java interface
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
 
Classes And Methods
Classes And MethodsClasses And Methods
Classes And Methods
 
OOP java
OOP javaOOP java
OOP java
 
Chapter 2 c#
Chapter 2 c#Chapter 2 c#
Chapter 2 c#
 
Programming in c++
Programming in c++Programming in c++
Programming in c++
 
Static and Dynamic polymorphism in C++
Static and Dynamic polymorphism in C++Static and Dynamic polymorphism in C++
Static and Dynamic polymorphism in C++
 
My c++
My c++My c++
My c++
 
Md03 - part3
Md03 - part3Md03 - part3
Md03 - part3
 
C# interview
C# interviewC# interview
C# interview
 
Vhdl
VhdlVhdl
Vhdl
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
 
Keywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.netKeywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.net
 
Dacj 2-1 c
Dacj 2-1 cDacj 2-1 c
Dacj 2-1 c
 
Ej Chpt#4 Final
Ej Chpt#4 FinalEj Chpt#4 Final
Ej Chpt#4 Final
 

En vedette

Resume - Isha Gupta
Resume - Isha GuptaResume - Isha Gupta
Resume - Isha Gupta
Isha Gupta
 
Jason Hyatt, PMP - Resume - Project Manager - 2014-11-27
Jason Hyatt, PMP - Resume - Project Manager - 2014-11-27Jason Hyatt, PMP - Resume - Project Manager - 2014-11-27
Jason Hyatt, PMP - Resume - Project Manager - 2014-11-27
Jason Hyatt, PMP
 
Neeraj Goswami
Neeraj GoswamiNeeraj Goswami
Neeraj Goswami
ngoswami
 
Anusha S Daragshetti Resume
Anusha S Daragshetti ResumeAnusha S Daragshetti Resume
Anusha S Daragshetti Resume
Anusha Desai
 
110852 - Resume Abhijit Chatterjee (Details)
110852 - Resume Abhijit Chatterjee (Details)110852 - Resume Abhijit Chatterjee (Details)
110852 - Resume Abhijit Chatterjee (Details)
Abhijit Ch
 

En vedette (20)

Resume - Isha Gupta
Resume - Isha GuptaResume - Isha Gupta
Resume - Isha Gupta
 
Maninder Singh Resume
Maninder Singh ResumeManinder Singh Resume
Maninder Singh Resume
 
Nirmalya Sarkar-Resume.
Nirmalya Sarkar-Resume.Nirmalya Sarkar-Resume.
Nirmalya Sarkar-Resume.
 
Jason Hyatt, PMP - Resume - Project Manager - 2014-11-27
Jason Hyatt, PMP - Resume - Project Manager - 2014-11-27Jason Hyatt, PMP - Resume - Project Manager - 2014-11-27
Jason Hyatt, PMP - Resume - Project Manager - 2014-11-27
 
Lecture handout by Mohd. Ayub Khan
Lecture handout by Mohd. Ayub KhanLecture handout by Mohd. Ayub Khan
Lecture handout by Mohd. Ayub Khan
 
Cv 23092008
Cv 23092008Cv 23092008
Cv 23092008
 
Paramjeet s resume
Paramjeet s resumeParamjeet s resume
Paramjeet s resume
 
Neeraj Goswami
Neeraj GoswamiNeeraj Goswami
Neeraj Goswami
 
My updated resume
My updated resumeMy updated resume
My updated resume
 
Sambhaji Rao Bhonsle -
Sambhaji Rao Bhonsle -Sambhaji Rao Bhonsle -
Sambhaji Rao Bhonsle -
 
Kishore resume
Kishore resumeKishore resume
Kishore resume
 
Anusha S Daragshetti Resume
Anusha S Daragshetti ResumeAnusha S Daragshetti Resume
Anusha S Daragshetti Resume
 
KaushikDutta Resume
KaushikDutta ResumeKaushikDutta Resume
KaushikDutta Resume
 
document(1)
document(1)document(1)
document(1)
 
110852 - Resume Abhijit Chatterjee (Details)
110852 - Resume Abhijit Chatterjee (Details)110852 - Resume Abhijit Chatterjee (Details)
110852 - Resume Abhijit Chatterjee (Details)
 
Resume making workshop
Resume making workshopResume making workshop
Resume making workshop
 
cv upat
cv upatcv upat
cv upat
 
Cv nilankarghosh
Cv nilankarghoshCv nilankarghosh
Cv nilankarghosh
 
Resume-Srikanth_Jogula
Resume-Srikanth_JogulaResume-Srikanth_Jogula
Resume-Srikanth_Jogula
 
Santanu-Ghosh-CV
Santanu-Ghosh-CVSantanu-Ghosh-CV
Santanu-Ghosh-CV
 

Similaire à Vb net xp_04

Vb.net session 04
Vb.net session 04Vb.net session 04
Vb.net session 04
Niit Care
 
Vb net xp_03
Vb net xp_03Vb net xp_03
Vb net xp_03
Niit Care
 
10 ap week 7 vbnet statements-genesis eugenio
10 ap week 7 vbnet statements-genesis eugenio10 ap week 7 vbnet statements-genesis eugenio
10 ap week 7 vbnet statements-genesis eugenio
DaniloAggabao
 
C#3.0 & Vb 9.0 New Features
C#3.0 & Vb 9.0 New FeaturesC#3.0 & Vb 9.0 New Features
C#3.0 & Vb 9.0 New Features
techfreak
 

Similaire à Vb net xp_04 (20)

Vb.net session 04
Vb.net session 04Vb.net session 04
Vb.net session 04
 
Vb net xp_03
Vb net xp_03Vb net xp_03
Vb net xp_03
 
VB.net
VB.netVB.net
VB.net
 
Generics
GenericsGenerics
Generics
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
ASP.Net Technologies Part-2
ASP.Net Technologies Part-2ASP.Net Technologies Part-2
ASP.Net Technologies Part-2
 
Introduction to Visual Basic
Introduction to Visual Basic Introduction to Visual Basic
Introduction to Visual Basic
 
ptu3-harvey-m-deitel-paul-j-deitel-tem-r-nieto-contributor-paul-j-deitel.pdf
ptu3-harvey-m-deitel-paul-j-deitel-tem-r-nieto-contributor-paul-j-deitel.pdfptu3-harvey-m-deitel-paul-j-deitel-tem-r-nieto-contributor-paul-j-deitel.pdf
ptu3-harvey-m-deitel-paul-j-deitel-tem-r-nieto-contributor-paul-j-deitel.pdf
 
.Net Classes and Objects | UiPath Community
.Net Classes and Objects | UiPath Community.Net Classes and Objects | UiPath Community
.Net Classes and Objects | UiPath Community
 
Certification preparation - Net classses and functions.pptx
Certification preparation - Net classses and functions.pptxCertification preparation - Net classses and functions.pptx
Certification preparation - Net classses and functions.pptx
 
Procedures functions structures in VB.Net
Procedures  functions  structures in VB.NetProcedures  functions  structures in VB.Net
Procedures functions structures in VB.Net
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
10 ap week 7 vbnet statements-genesis eugenio
10 ap week 7 vbnet statements-genesis eugenio10 ap week 7 vbnet statements-genesis eugenio
10 ap week 7 vbnet statements-genesis eugenio
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
SQL Saturday 28 - .NET Fundamentals
SQL Saturday 28 - .NET FundamentalsSQL Saturday 28 - .NET Fundamentals
SQL Saturday 28 - .NET Fundamentals
 
C# interview-questions
C# interview-questionsC# interview-questions
C# interview-questions
 
Programming by imitation
Programming by imitationProgramming by imitation
Programming by imitation
 
C#.net, C Sharp.Net Online Training Course Content
C#.net, C Sharp.Net Online Training Course ContentC#.net, C Sharp.Net Online Training Course Content
C#.net, C Sharp.Net Online Training Course Content
 
C#3.0 & Vb 9.0 New Features
C#3.0 & Vb 9.0 New FeaturesC#3.0 & Vb 9.0 New Features
C#3.0 & Vb 9.0 New Features
 

Plus de Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Vb net xp_04

  • 1. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Objectives In this lesson, you will learn to: Identify the different types of procedures in Visual Basic .NET Identify the importance of procedure overloading Identify the importance of procedure overriding Implement the MsgBox( ) function Implement the CommonDialog classes ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 1 of 34
  • 2. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Procedures Are sets of one or more program statements that can be executed by referring to the procedure name. Are the key to modular programming. They simplify the task of maintaining and debugging the application code. Are useful for performing repetitive tasks, such as fetching specific records from a database, and text and control manipulation. Are of three types: Sub procedures Function procedures Property procedures ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 2 of 34
  • 3. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Sub Procedure Is a block of code enclosed within the Sub and End Sub statements. Does not return a value. However, it can take arguments, such as constants, variables, and expressions that are passed to it by the calling code. Example Public Sub Check_Acct_Status (ByVal CustAcct As Integer, ByVal Amount As Single) ’The statements of the Sub procedure are given here. End Sub ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 3 of 34
  • 4. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Sub Procedure (Contd.) Can be defined in a module, a class, or a structure. Can be created with one of the following access modifiers: Public Protected Friend Protected Friend Private ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 4 of 34
  • 5. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Sub Procedure (Contd.) Can take arguments. You declare each argument by specifying the argument name and the data type. Can have an optional argument. An optional argument must be declared at the end of the argument list and must have a default value. Can be called by using the Call keyword and providing values for all the arguments that are not optional. You can pass arguments to a sub procedure either by value or by reference. Can be further categorized as: General procedures Event-handling procedures ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 5 of 34
  • 6. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Sub Procedure (Contd.) General procedure Is a block of code that performs a specific task. Event-handling procedure Is a block of code that is executed when a specific event occurs, such as the click of a button or the loading of a form in the memory. Is a combination of the object name and the type of event that has occurred. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 6 of 34
  • 7. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Function Procedure Is a block of code enclosed within the Function and End Function statements. Returns a value to the calling code. Example Public Function Check_Acct_Status (ByVal CustAcct As Integer, ByVal Amount As Single) As Integer ' The statements of the Sub procedure are given here. Return Amount End Function ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 7 of 34
  • 8. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Function Procedure (Contd.) Can be defined in a module, a class, or a structure. Can be created with one of the following access modifiers: Public, Protected, Friend, Protected Friend, and Private. Has Public access by default. Uses the Return statement to return a value to the calling procedure. Return value can be trapped by calling a function and assigning the return value of the function to a variable. Example TotalAmount = Calculate_Amount(Total_Salary,months) ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 8 of 34
  • 9. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Property Procedure Is a set of code statements that are used to assign or retrieve the values of the properties declared within a module, a class, or a structure. Is a type of variable that stores the values of an object of a class or a structure. Can help you define a property as read-only, write-only, or read/write type. Is of two types: Get procedures are used to retrieve the values from a property. Set procedures are used to assign values to a property. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 9 of 34
  • 10. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Property Procedure (Contd.) Is always invoked implicitly by the code that refers to the property, that is, the code uses the name of the property and provides values for all the arguments that are not optional. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 10 of 34
  • 11. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Passing Arguments to a Procedure You can pass arguments to a procedure: By value using the ByVal keyword By reference using the ByRef keyword In Visual Basic .NET, the default argument passing mechanism is ByVal. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 11 of 34
  • 12. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Parameter Array Can be used to pass an array of values for an argument of a procedure. Is defined by using the keyword ParamArray. Rules: You cannot use more than one parameter array in a procedure, and it must be the last argument in the procedure definition. The parameter array must be passed by value. The code within the procedure must use the parameter array as a one-dimensional array. In addition, each element of the array must be of the same data type as the data type of ParamArray. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 12 of 34
  • 13. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Parameter Array (Contd.) The parameter array is optional. The default value of a parameter array is an empty one-dimensional array. The parameter array must be the lone optional argument in the list of arguments for a procedure. All other arguments preceding the parameter array must be used. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 13 of 34
  • 14. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Procedure Overloading Means defining multiple procedures using the same name but different argument lists, also referred to as signature. When you overload a procedure: Each overloaded version uses the same procedure name. Each overloaded version differs from all the other overloaded versions in one of the following ways: ®The number of arguments ®The order of the arguments ®The data types of the arguments ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 14 of 34
  • 15. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Procedure Overloading (Contd.) You cannot overload a procedure by varying only one or more of the following items: The procedure modifiers, such as Public, Shared, and Static The argument names The argument modifiers, such as ByRef and Optional The data type of the return value ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 15 of 34
  • 16. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Procedure Overriding Means redefining a base class procedure in a derived class without changing the name of the procedure. Rules: You can override procedures that are declared with the Overridable keyword in the base class. You need to explicitly declare a procedure in the base class with the Overridable keyword in order to override it in the derived class. Overridden procedures need to have the same arguments as the inherited members from the base class. The redefined implementation of a procedure in the derived class can call the implementation defined in the parent class by specifying MyBase keyword before the procedure name. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 16 of 34
  • 17. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Built-in Functions in Visual Basic .NET Functions Usage Len (string expression) To find the length of the string expression that is passed as the argument Mid (string expression, starting position, To extract a particular number of number of characters) characters, starting at a given character position, from the string expression that is passed as the argument CDate (string expression) To convert the string expression that is passed as the argument to the Date type CTime (string expression) To convert the string expression that is passed as the argument to the Time type Val (string/object/ char expression) To convert the numbers contained in a string/char/object to a numeric value ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 17 of 34
  • 18. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Built-in Functions in Visual Basic .NET(Contd.) Functions Usage CBool (expression) To convert a string or numeric expression to Boolean values CByte (string/numeric expression) To convert a string or a numeric expression to a Byte data type CInt (string/numeric expression) To convert a string or a decimal expression to an integer CObj (string/numeric expression) To convert a string or numeric value to an object CChar (string/numeric expression) To convert a string or numeric value to a Char CStr (string/numeric expression) To convert a string or numeric value to a String CDec (string/numeric expression) To convert a string or numeric value to a Decimal CType(expression.datatype/object/class/ To convert an expression from one type structure) to another ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 18 of 34
  • 19. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Problem Statement 4.D.1 The customer data entry forms at the call centers of Diaz Telecommunications need to include options to check for a valid customer ID and telephone number. The customer ID should start with the letter ‘C’ and have three digits after it. The telephone number should consist of eight digits. The form should also have the facility to display error messages when incorrect data is entered. Additionally, the form should have the provision to clear the last customer details entered. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 19 of 34
  • 20. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Task List Identify the checks that need to be applied on the form. Identify the changes needed in the design of the form. Identify the mechanism to display error messages. Add the additional controls to the form. Check the data and display an error message. Save the application. Run the application to validate the checks applied on the form. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 20 of 34
  • 21. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Task 1: Identify the checks that need to be applied on the form. Result: As per the problem statement, the customer data entry form needs to have a provision to check for a valid customer id and telephone number. You can add the provision for checking the validity of the customer id and the telephone number by including procedures in the customer data entry application. Since Visual Basic .NET allows the use of procedure overloading, you can create two versions of a procedure in the customer data entry application to check the validity of the customer id and the telephone number. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 21 of 34
  • 22. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Task 2: Identify the changes needed in the design of the form. You will create an overloaded procedure for checking the validity of the customer id and the telephone number. You can name the procedure Check_data (). Result: The following table recommends suitable prefixes that you can use for the two buttons: Object Prefix Example Button cmd cmdCheckdata Button cmd cmdReset ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 22 of 34
  • 23. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Task 3: Identify the mechanism to display error messages. Messages can be displayed by using either Msgbox ()Function MessageBox Class ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 23 of 34
  • 24. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Task 3: Identify the mechanism to display error messages. (Contd.) Result: To display an error message to users when an invalid customer id or telephone number is entered in the customers data entry form, you can use either the MessageBox class or the built-in MsgBox()function. Since MessageBox class offers greater control over the interface of the message box, such as displaying appropriate icons, you should use the MessageBox class to display error message when invalid customer id or telephone number is entered. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 24 of 34
  • 25. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Task 4: Add the additional controls to the form. Task 5: Check the data and display an error message. Task 6: Save the application. Task 7: Run the application to validate the checks applied on the form. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 25 of 34
  • 26. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Problem Statement 4.P.1 The Employee data entry form in the call centers at Diaz Telecommunications requires options to check for valid employee ID and age entries. The employee ID should start with the letter ‘E’ and have three digits after it. The age should be more than 20 years and less than 61 years. The form should also have the facility to display error messages when incorrect data is entered. Additionally, the form should have a provision to clear the last employee details entered. The details of an employee essentially include the employee id, the employee’s first name, the employee’s last name, the address, the age, the date of joining, the department, and the salary. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 26 of 34
  • 27. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Just a Minute… 2. There are two labels named Label1 and Label2 and one button named Button1 on the form, Form1. Predict the output of the code, when Button1 is clicked at run time. 3. There are two labels named Label1 and Label2 and one button named Button1 on the form, Form1. You have created a user-defined Sub procedure called MySub to process information when the user clicks Button1. Predict the output of the code, when the program is executed. 4. There is one label named Label1 and one button named Button1 on the form, Form1. What will be the output of the code when Button1 is clicked at run time? ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 27 of 34
  • 28. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Common Dialog Classes Are used to access the default Font dialog box to change the font of the text or used to open a file by using the Open dialog box and display the contents. Are of the following types: ColorDialog FontDialog FileDialog PrintDialog PageSetupDialog ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 28 of 34
  • 29. Introducing Procedures and CommonDialog Classes in Visual Basic .NET ColorDialog Class Is used to change the background and the foreground color of text. FontDialog Class Is used to change the font, the font style, and the size of text. FileDialog Class Is an abstract class that is inherited from the CommonDialog class. You cannot instantiate it directly. However, you can use the OpenFileDialog or SaveFileDialog class to open a file or save an existing file. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 29 of 34
  • 30. Introducing Procedures and CommonDialog Classes in Visual Basic .NET PrintDialog Class Is used to print text or graphics. PageSetupDialog Class Used to set the page details for printing in Windows applications. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 30 of 34
  • 31. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Just a Minute… 2. What will be the output of the code when Button1 is clicked at run time? 3. The code snippet is written in the Code Editor window of Form1. While building the project, there was a build error. What would you do to resolve the error? ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 31 of 34
  • 32. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Summary In this lesson, you learned that: A procedure is a set of one or more program statements that can be executed by referring to the procedure name. Procedures are of three types: Sub Function Property Sub procedures can be of two types: General Event-handling ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 32 of 34
  • 33. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Summary (Contd.) Property procedure is of two types: Get procedures are used to retrieve values from a property. Set procedures are used to assign values to a property. Property procedures are used to access properties declared within a module, a class, or a structure. Arguments can be passed to a procedure either by value or by reference. Parameter arrays enable you to pass an array of values as an argument to a procedure. Procedure overloading is defining multiple procedures having the same name but different argument lists. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 33 of 34
  • 34. Introducing Procedures and CommonDialog Classes in Visual Basic .NET Summary (Contd.) Procedure overriding enables you to redefine a base class procedure in a derived class without changing the name of the procedure. The CommonDialog class is the base class for the most commonly used dialog boxes, such as, Font, File, Print, and Page Setup. ©NIIT Introducing Procedures and CommonDialog Classes in VB .NET/Lesson 4/Slide 34 of 34