RSS feed

How to Write Select Case in VB

Select Case VB

Published by: San (9/20/2007)

SEP 20 2007

Select Case Statement in vb is as like as other programming languages. Select expression holds the variable having the value and case expression list is the use case. Statement is the ToDo when condition satisfies. Multiple cases can be used simultaneously.

Select Case number
  Case 1 To 4
    Debug.WriteLine("Value between 1 To 4")
  Case 5, 6, 7
    Debug.WriteLine("Value between 5 To 7")
  Case 8 To 10
    Debug.WriteLine("Value between 8 To 10")
  Case Else
    Debug.WriteLine("value not in 1 To 10")
End Select

Example above has a variable called number, once the value is assigned to it then the cases matches with individual numbers. On condition satisfies it prints out the message.

 

How to Code and Decode an URL >>

<< How Can I Get a Line Break in My Text Email

 

COMMENT

*Name:
*Comment:
You can use HTML tags here.
*Code: Please enter the sum of 5+2