Advertisement
Luciano_fuentes

¿Array or Select Case?

Sep 24th, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     Dim arrays(1 To 3) As Integer
  3.    
  4.     '@@ Forma 1:
  5.    arrays(1) = 10
  6.     arrays(2) = 40
  7.     arrays(3) = 80
  8.    
  9.     If Val(Text1.Text) > 0 And Val(Text1.Text) < 4 Then _
  10.         MsgBox "Acertado! " & arrays(Val(Text1.Text))
  11.    
  12.     '@@ Forma 2:
  13.    Select Case Val(Text1.Text)
  14.    
  15.         Case 1
  16.             MsgBox "Acertado! 10"
  17.    
  18.         Case 2
  19.             MsgBox "Acertado! 40"
  20.            
  21.         Case 3
  22.             MsgBox "Acertado! 80"
  23.    
  24.     End Select
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement