If..Then..Else could be very messy,if you have a lot of conditional statements.It is better to use Select Case for multiple conditional statements.
The format is :
Select Case expression
Case value1
Block of one or more VB statements
Case value2
Block of one or more VB Statements
Case value3
Block of one or more VB statements
Case value4
.
.
.
Case Else
Block of one or more VB Statements
End Select
The example given below shows the use of Select Case Statement in VB
' Examination Grades
Dim grade As String
Private Sub Compute_Click( )
grade=txtgrade.Text
Select Case grade
Case "A"
result.Caption="High Distinction"
Case "A-"
result.Caption="Distinction"
Case "B"
result.Caption="Credit"
Case "C"
result.Caption="Pass"
Case Else
result.Caption="Fail"
End Select
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
More on Program Control in vb,
visual basic control,
source code control,
vb source code,
visual basic vb,
visual basic net control,
vb sample code,
asp net control,
vb asp net,
vb tutorials,
vb timer,
vb array,
vb code,
vb msgbox,
vb dim,
vb byval,
vb treeview