VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



split function with a textbox

by Rokinroj (3 Submissions)
Category: Data Structures
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

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

Assumes
text1.text needs to contain a list of text that is seperated by a return

Rate split function with a textbox

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

Download this snippet    Add to My Saved Code

split function with a textbox Comments

No comments have been posted about split function with a textbox. Why not be the first to post a comment about split function with a textbox.

Post your comment

Subject:
Message:
0/1000 characters