Using CASES to generate random items

/ Published in: VB.NET
Save to your folder(s)

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

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.