is it possible to load the textbox number as an array. The array holds a number which adds 1 by every function call I tied to do this:
TextBox(num).text = word(curNumber.ToString())
But it didn't work. I will be grateful for any help thanks in advance
edit: what i am in fact trying to do is create a key generator for other projects that i have made\will make here is the code:
Public Class Form1
Dim word(20) As String
Dim num(5) As TextBox
Dim alreadyPicked As List(Of Integer) = New List(Of Integer)
Public Sub random()
num = num + 1 'error here
Dim curNumber As Integer
If (alreadyPicked.Count < 21) Then
Dim rand As Random = New Random
Do
curNumber = rand.Next(1, 21)
Loop While (alreadyPicked.Contains(curNumber))
End If
If (curNumber > 0 AndAlso Not alreadyPicked.Contains(curNumber)) Then
alreadyPicked.Add(curNumber)
TextBox2.Text = TextBox2.Text + curNumber.ToString() + ", "
num.text = word(curNumber.ToString()) 'error here
Else
MessageBox.Show("Error")
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
random()
alreadyPicked = New List(Of Integer)
TextBox2.Text += Environment.NewLine
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
word(0) = "1A"
word(1) = "2D"
word(2) = "2D"
word(3) = "1A"
word(4) = "3B"
word(5) = "1E"
word(6) = "5A"
word(7) = "6E"
word(8) = "6D"
word(9) = "1E"
word(10) = "7C"
word(11) = "2A"
word(12) = "6B"
word(13) = "2D"
word(14) = "7D"
word(15) = "4E"
word(16) = "9A"
word(17) = "8B"
word(18) = "4C"
word(19) = "7E"
End Sub
Private Sub TextBox(num As Integer())
Throw New NotImplementedException
End Sub
End Class