I have some vb6.0 code. If I use redim, ubounds seems to fail (where using just dim with a specified number works). Also, I tried dim and redim, with dim(0), and then redim(x); ubounds still returned 0.
The error I get is subscript out of range (9). This happens on the first Ubound in the for loop. Please don't suggest avoiding this with error handling, as I want Ubound to work.
Private validMacAddresses() As String
Private numbOfMacAddresses As Integer
Private Sub Class_Initialize()
Const numbOfMacAddresses = 1 'real numb, not counting zero!
vaildMacAddresses(0) = "11-11-11-11-11-11"
'validMacAddresses(0) = "00-06-1B-C6-77-F4"
'validMacAddresses(0) = "00-05-4E-42-70-26"
If (MsgBox(IsArray(vaildMacAddresses), vbYesNo, "index") = vbNo) Then
Dim xx As Integer 'ensure all upper case
For xx = 0 To (UBound(validMacAddresses) - 1)
If (MsgBox(UBound(validMacAddresses), vbYesNo, "index") = vbNo) Then
vaildMacAddresses(xx) = UCase(vaildMacAddresses(xx))
vaildMacAddresses(xx) = Replace(vaildMacAddresses(xx), "-", "")
vaildMacAddresses(xx) = Replace(vaildMacAddresses(xx), " ", "")
If Len(validMacAddresses(0)) <> 12 Then
validMacAddresses(xx) = "Bad Mac Address"