README.md
December 4, 2022 ยท View on GitHub
Description
Good example of the split and randomize commands.
lets you place a long list of text in a textbox and randomly grab a line. My use for this was I had about 500 cd keys to issue to customers as they would callin. I would run this script, give them a number, remove from my list later, etc.
Possible uses might be for numbers, tip of the day quotes, etc.
Rokinroj
More Info
text1.text needs to contain a list of text that is seperated by a return
| Submitted On | |
| By | Rokinroj |
| Level | Intermediate |
| User Rating | 5.0 (15 globes from 3 users) |
| Compatibility | VB 5.0, VB 6.0 |
| Category | Data Structures |
| World | Visual Basic |
| Archive File |
Source Code
Private sArray() As String
Private Sub cmdGetKey_Click()
Dim RandNum As Long
Randomize
RandNum = Int(Rnd * 1446) + 1
Text1.Text = sArray(RandNum)
End Sub
Private Sub Form_Load()
sArray() = Split(txtKeys.Text, vbCrLf)
End Sub