Long story short I am trying to use an ArrayList instead of an array to try and avoid some ReDim statements with the Preserve option on. However, once I put something in the array list I can't get it back out.
I have this code:
Now I can do this:
But when I try to do this:
I get a complier error that 'option strict disallows late binding'. Microsoft's answer is to turn strict off. I do not want to - I have it on for a reason.
This:
Throws a compiler error that can't convert from System.Object to VSAN.
So what to do?
I have this code:
Code:
[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] VSANList [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] ArrayList [/SIZE] [SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE][SIZE=2] VSAN [/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] vsanName [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String [/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] vsanNum [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String [/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] domainID [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff].....[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff]End Class [/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2] [/SIZE]
Code:
[SIZE=2]VSANList(0) = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] VSAN[/SIZE] [SIZE=2][/SIZE]
But when I try to do this:
Code:
[SIZE=2]VSANList(0).vsanName = "tester"[/SIZE] [SIZE=2][/SIZE]
I get a complier error that 'option strict disallows late binding'. Microsoft's answer is to turn strict off. I do not want to - I have it on for a reason.
This:
Code:
[SIZE=2]Dim aVSAN As New VSAN[/SIZE] [SIZE=2]aVSAN = VSANList.Item(0)[/SIZE] [SIZE=2][/SIZE]
Throws a compiler error that can't convert from System.Object to VSAN.
So what to do?



Comment