'McIntyre Case Statements
Public Class Form1  
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load  
     Dim number As Integer = 8  
     Select Case number  
       Case 1 To 5  
         Debug.WriteLine("Between 1 and 5, inclusive")  
         ' The following is the only Case clause that evaluates to True.  
       Case 6, 7, 8  
         Debug.WriteLine("Between 6 and 8, inclusive")  
       Case 9 To 10  
         Debug.WriteLine("Equal to 9 or 10")  
       Case Else  
         Debug.WriteLine("Not between 1 and 10, inclusive")  
     End Select  
   End Sub  
 End Class  
Monday, January 31, 2011
Programming 2 /* Case Statements */
A select-case statement is a great way to perform a logical test that might have multiple directions if found true or false. You could write a bunch of if-then-else statements but that could be very cumbersome. Here is how you utilize the Select-Case statement.
Subscribe to:
Post Comments (Atom)
Classes
Programming II
Advanced Relational Database
Blog Archive
- 
        ▼ 
      
2011
(35)
- 
        ▼ 
      
January
(19)
- Challenge me in Mini Putt!
- Advanced Relational Database /* Inner Join between...
- Programming 2 /* Case Statements */
- Programming 2 /* If Statements */
- How to draw a Cartoon Banana.
- Programming 2 /* Practice #1 - Acts and Facts */
- Programming 2 /* how to join a string to another s...
- Programming 2 /* how to convert an integer into a ...
- Advanced Relational Database /* Assignment 1 Frog ...
- Creating A Database in Microsoft SQL Server 1/24/11
- Converting a number variable into a string 1/24/11
- Variables in Visual Basic 1/24/11
- Advanced Relational Database /* Testing the creati...
- Advanced Relational Database /* Testing the creati...
- Advanced Relational Database /* Testing the creati...
- Advanced Relational Database /* Temp Tables and Ta...
- Programming 2 /* Repeatable Processing */ 1/19/11
- M&M
- Code
 
 
- 
        ▼ 
      
January
(19)
 
No comments:
Post a Comment