I have been working with an API for a software application that we have in our office and I am unsure about how to get past this point.
The API calls for everything to be of type "Object". I have a specific part of it that i need to be able to loop through and create an object out of a string. I have been able to do this, but it makes the variable now be of type string instead of "Object".
Here's an example of what I know works:
The reason it works is that I know that the path to the "folder" is 2 folders deep.
My problem is that I need to be able to specify a path to the folder and have it be varying levels deep. I want to be able to have folder be either 3, 4 or 5 levels deep depending on the path I send in.
Here is the code that I have tried but does not work:
After this code is run the object "folder" is now of type "String" instead of "Object".
Any ideas or comments would be appreciated.
Thanks,
Josh
The API calls for everything to be of type "Object". I have a specific part of it that i need to be able to loop through and create an object out of a string. I have been able to do this, but it makes the variable now be of type string instead of "Object".
Here's an example of what I know works:
Code:
Dim database As Object, folder As Object
database = fortApp.Databases(configData.ImagingDBName)
folder = database.RootFolder.Folders(TextBox1.Text).Folders(TextBox4.Text)
The reason it works is that I know that the path to the "folder" is 2 folders deep.
My problem is that I need to be able to specify a path to the folder and have it be varying levels deep. I want to be able to have folder be either 3, 4 or 5 levels deep depending on the path I send in.
Here is the code that I have tried but does not work:
Code:
Dim i As Integer
Dim folderNames() As String = configData.FolderPath.Split(";")
Dim folderStr As String
folderStr = "database.RootFolder"
For i = 0 To folderNames.Length - 1
folderStr = folderStr & ".Folders(" & folderNames(i) & ")"
Next
folder = CType(folderStr, Object)
Any ideas or comments would be appreciated.
Thanks,
Josh