Jack_NL
New member
Hi all,
I making a pool system, people can win things. It works fine, but after 3 clicks on the Random button i get a 'System.IndexOutOfRangeException' error.
First few times it works fine, then suddenly it get this error. It happens at the EmailTxt.Text = sp(1) part. Am i doing something wrong?
I making a pool system, people can win things. It works fine, but after 3 clicks on the Random button i get a 'System.IndexOutOfRangeException' error.
VB.NET:
Private Sub Random_Click(sender As Object, e As EventArgs) Handles Random.Click
UserTxt.Text = String.Empty
EmailTxt.Text = String.Empty
Dim r As New Random
RandomTxt.Text = ListBox1.GetItemText(ListBox1.Items(r.Next(0, ListBox1.Items.Count)))
Dim s As String
Dim sp() As String
Dim substring As String
s = RandomTxt.Text
sp = s.Split(":")
UserTxt.Text = sp(0)
EmailTxt.Text = sp(1)
End Sub
First few times it works fine, then suddenly it get this error. It happens at the EmailTxt.Text = sp(1) part. Am i doing something wrong?