I need to call a function that takes an array of drive letters as one of its arguments. The sample I received from the dev team that created the object uses VBScript and looks like this:
Array("C:","D:")
This doesn’t work in VB.NET so I tried the following code. Note: The drives are passed to me in a comma separated string:
Dim drives As String = "C,D"
Dim volumeList As String() = drives.Split(","c)
For i As Integer = 0 To volumeList.Length - 1
volumeList(i) &= ":"
Next
Then I try to pass volumeList to the function in question and I get an invalid argument exception. Is there some other way I could try to create/pass this array so that it acts like the VBScript example? I told the developer what I’m doing and he said “hhmm… should work.” So I’d like to figure it out without having to force this guy to help me.
EDIT: The com server expects an array of type variant (VB6). That is the problem. Sadly EVERYTHING I try in VB.NET fails.
VB6 variant datatype is equivalent to object in VB.Net.