Microsoft Visual Basic 'NET Language - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Microsoft Visual Basic 'NET Language

Description:

Example1 : Dim Result As Integer = 0. Dim I As Integer. For I = 1 To 5. Result = I. Next ... Example1 : Dim Result As Integer = 0. Dim I As Integer = 0. Do ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 12
Provided by: bcSia
Category:

less

Transcript and Presenter's Notes

Title: Microsoft Visual Basic 'NET Language


1
MicrosoftVisual Basic .NETLanguage 2
2
Flow-Control Statements
  • If End If
  • Select Case End Select
  • For Next
  • Do Loop
  • Exit

3
If End If
If Condition Then End If
Example If Scoregt80 Then Result
"A" ElseIf Scoregt50 Then Result "B" Else
Result "F" End If
If Condition Then Else End If
If Condition1 Then ElseIf Condition2
Then End If
4
Select Case End Select
Select Case Expression Case value1 Case
value2 . . . Case Else End Select
Example Select Case Score Case 80 To
100 Result "A" Case 70 To 79 Result
"B" Case 60 To 69 Result "C" Case
Else Result "F" End Select
5
Example IfThenElse, SelectCase
Example SelectCase Select Case Score Case 80
To 100 Result "A" Case 70 To 79 Result
"B" Case 60 To 69 Result "C" Case
Else Result "F" End Select
Example IfThenCase If Scoregt80 Then
Result "A" ElseIf Scoregt50 Then Result
"B" Else Result "F" End If
6
Example 1
7
For Next
For Counter Start To End Next -------
-----------or-------------------- For Counter
As Integer Start To End Next
Example1 Dim Result As Integer 0 Dim I As
Integer For I 1 To 5 Result I Next MsgBox
(Result I)
Example2 Dim Result As Integer 0 For I As
Integer 1 To 5 Result I Next MsgBox
(Result I)
8
Do Loop
Do While/Until Condition Loop
Do Loop While/Until Condition
Example1 Dim Result As Integer 0 Dim I As
Integer 0 Do Until Igt2 I 1 Result
I Loop MsgBox (Result I)
Example2 Dim Result As Integer 0 Dim I As
Integer 0 Do While I lt 2 I 1 Result
I Loop MsgBox (Result I)
9
Exit
  • Exit from block of statements in a control
    structure.

Example Dim I As Integer 0 Dim Result As
Integer 0 Do Until Igt4 I 1 Result I If
Resultgt5 Then Exit Do End If Loop MessageBox.Sh
ow (Result I)
10
Sub
Scope Sub name(param1) End Sub
Public Sub SayHello() MessageBox.Show ("Hello
World") End Sub
Public Sub SayHello(ByVal Name As String)
MessageBox.Show ("Hello " Name) End Sub
Call SayHello("Peter")
11
Function
Scope Function name(param1) As Type End
Sub
Public Function Add() As Integer Return 0 End Sub
Public Function Add(ByVal Val1 As Integer, ByVal
Val2 As Integer) As Integer Return Val1Val2 End
Sub
A Add( 3 , 4 )
Write a Comment
User Comments (0)
About PowerShow.com