Posted By

brandonio21 on 07/23/10


Tagged

random items cases


Versions (?)

Using CASES to generate random items


 / Published in: VB.NET
 

URL: http://brandonsoft.com

This code can be used to make random items from a list of specified items.

  1. Private sub random() 'Creates the sub
  2. dim textbox as new textbox 'Makes a new textbox to store data
  3. textbox.text = Int(Rnd() * 2) 'Tells the program to put the random thing inside of the textbox
  4. Select Case textbox.text 'Starts the case block
  5. Case 0 '1st case define
  6. textbox.text = "lol" 'Whats inside of case 0
  7. Case 1 '2nd case define
  8. textbox.text = "lawl" 'Whats inside of case 1
  9. End Select 'End the case block
  10. msgbox(textbox.text) 'Puts the random variable in a message box
  11. End sub 'Ends the sub

Report this snippet  

You need to login to post a comment.