Hey guys thanks for viewing this post.
I have created an array to store usernames and passwords. Im tryning to get the array ReDim-ed mid program.
Here is the array:
Public Sub Usernames_Passwords()
'Assigns names to array space 1
arrNames(0, 0) = "bnsjon"
arrNames(1, 0) = "bnsjack"
arrNames(2, 0) = "bnsjane"
arrNames(3, 0) = "bnsjill"
'Assigns Passwords to array space 2
arrNames(0, 1) = "jon"
arrNames(1, 1) = "jack"
arrNames(2, 1) = "jane"
arrNames(3, 1) = "jill"
End Sub
This is the code I tried using to get the array ReDim-ed :
Private Sub Form_Load()
Dim u As Integer
'Redims the array arrNames with new holding amount
'while preserving previous values
u = 3
u = u + 1
ReDim Preserve arrNames(u, 1) As String
End Sub
Private Sub btnAdd_Click()
'Assigns new name and password to array
arrNames(u, 0) = txtName.Text
arrNames(u, 1) = txtPassword.Text
End Sub
But I get this error.
Compile Error:
Array already defined
And it highlights this line
Private Sub Form_Load()
Dim u As Integer
'Redims the array arrNames with new holding amount
'while preserving previous values
u = 3
u = u + 1
ReDim Preserve arrNames(u, 1) As StringEnd Sub
Any takers?
Thanks in advance
-Russell aka Rabbit