Hi,
I'm very new to programming and i'm trying to create a word jumbler. The idea is someone types something in to a text box and a label displays the letters in a random order. I'm trying to use an array to ensure the same value doesn't appear twice can someone tell me where i'm going wrong?
I'm very new to programming and i'm trying to create a word jumbler. The idea is someone types something in to a text box and a label displays the letters in a random order. I'm trying to use an array to ensure the same value doesn't appear twice can someone tell me where i'm going wrong?
VB.NET:
[COLOR="Blue"]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rndNumber As Integer
Dim arrRepeat(TextBox1.Text.Length) As Integer
Dim store, txtCount, i As Integer
Label2.Text = " "
For txtCount = 1 To TextBox1.Text.Length
start: Randomize()
rndNumber = Int((Rnd()) * TextBox1.Text.Length)
For store = 0 To TextBox1.Text.Length - 1
If rndNumber = arrRepeat(store) Then
GoTo start
End If
arrRepeat(txtCount) = rndNumber
Next store
Next txtCount
For i = 0 To TextBox1.Text.Length - 1
Label2.Text = Label2.Text & TextBox1.Text.Chars((arrRepeat(i) + 1))
Next
End Sub[/COLOR]