Professional Documents
Culture Documents
CCP503
CCP503
CCP503
ANDHRAPRADESH
Name : K.Sreeramacharyulu
Designation : Lecturer
Branch : Commercial and Computer Practicee
Institute : Govt Polytechnic, Srikakulam
Year/Semester : V Semester
Subject : VISUAL BASIC-I
Sub. Code : CCP-503
Topic : Programming Fundamentals
Duration : 50 Mts
Sub. Topic : Decision control structures
Teaching Aids : PPT, Clips and Images
CCP503.33 1
Objective:
On completion of this period, you would be able to
know :
CCP503.33 2
Recap
Looping constructs
Do…while
For…Next
While…Wend
CCP503.33 3
Decision Constructs
CCP503.33 4
General Syntax Of Simple If
If <Condition> then
Executable Statement
End if
Condition is a Relational or Logical expression
Execute statements with If…End if , if the
condition tests ‘True’
Example:
If (age>=18) then
Msgbox(“ You are eligible to Vote”);
end if
CCP503.33 5
Program 1 on If…Then (Simple if)
CCP503.33 6
The program asks a number is greater than ‘0’,
it doubles it and shows the result
Fig 33.1
CCP503.33 7
Program 2 on If…Then…Else If
CCP503.33 8
Fig 33.2
CCP503.33 9
Program 3 on If…Then…Else
Follow the steps to develop application:
CCP503.33 12
Select…Case (Contd..)
Its construct is
Select Case Variable
Case value1
Statements
Case value2
Statements
Case Else
Statement when none of the above
conditions are satisfied
End Select
CCP503.33 13
Program 4 on Select…Case
Follow the steps to develop application:
CCP503.33 16
Fig 33.5
CCP503.33 17
Program 6 on Select…Case
CCP503.33 18
Fig 33.6
CCP503.33 19
Program 7 on Select…Case
Follow the steps to develop application:
CCP503.33 20
Fig 33.7
CCP503.33 21
Summary
CCP503.33 22
Frequently Asked Questions
CCP503.33 23
QUIZ
A. For … Next
B. IF … then….End if
C. Select …. Case
D. If … then … Else….end if
CCP503.33 24
2. Dim grade As String
Private Sub Compute_Click( )
grade=Input Box (“Enter grade as like (A/B/C): ”)
Select Case grade
Case "A"
Txtresult .Caption="Distinction"
Case “B"
Txtresult .Caption=“First Class"
Case “C”
Txtresult. Caption=“Pass”
Case Else
Txtresult .Caption="Fail"
End Select
In the above program, If grade is ” A” , what will be the
result?
a) Distinction
b) Pass
c) Fail
d) First Class
CCP503.33 25
Assignment
CCP503.33 26