Hello guys, I'm new to these forums so if this is the wrong section please redirect me :)
I've been fiddling with code to generate a random line from a source, so upon pressing a button the person would be given a random line from what is provided in a text box when the progress bar reaches 100%. Really simple.
Here's a snippet of the code. Let's say there's 5 lines.
This is the timer tick, as it's also associated with a progress bar
What happens when I do this is that the same format is shown in the textbox all the time, for example it shows line 3 > line 2 > 5 in the textbox, rather than being random. This happens when restarting the program, always in the same order.
My question is: How do I make it RANDOMLY select one of the lines, so it's in a different order each time?
Thanks a lot :)
I've been fiddling with code to generate a random line from a source, so upon pressing a button the person would be given a random line from what is provided in a text box when the progress bar reaches 100%. Really simple.
Here's a snippet of the code. Let's say there's 5 lines.
This is the timer tick, as it's also associated with a progress bar
Code:
If ProgressBar1.Value = ProgressBar1.Maximum Then
Dim key As Integer
key = Int(Rnd() * 5)
Select Case key
Case 1
TextBox1.Text = "line 1"
Case 2
TextBox1.Text = "line 2"
Case 3
TextBox1.Text = "line 3"
Case 4
TextBox1.Text = "line 4"
Case 5
TextBox1.Text = "line 5"
End Select
End If
End SubMy question is: How do I make it RANDOMLY select one of the lines, so it's in a different order each time?
Thanks a lot :)