Monday, January 31, 2011

Case statements

Here is an example of how to effectively write a Case statement. This Code is very useful in a prgram multiple outcomes to a problem.

 Dim fries As String
  
 Dim DietState As String 
  
 fries = TextBox1.Text
  
 Select Case creamcake
  
 Case "Eaten"
  
 DietState = "Diet Ruined"
  
 Case "Not Eaten"
  
 DietState = "Diet Not Ruined"
  
 Case Else
  
 DietState = "Didn't check"
  
 End Select
  
 MsgBox DietState
  

No comments:

Post a Comment