So I'm having problems when trying to make a treeview from a group. I have a folder structure in my database that gives me the path that each node should have. The problem is that the recursive parent seems to only look at the immediate parent child relationship as opposed to the full structure of the tree. The problem I have in my case is that what if I still need the tree, but there are is no data representing that specific folder. I am splitting up the folder structure to use the second to last entry in the array.
Public Shared Function Parent(ByVal Value As String, ByVal Delimiter As String) As String
Dim ListArray() As String
ListArray = Split(Value, Delimiter)
Dim LastNonEmpty As Integer = -1
For i As Integer = 0 To ListArray.Length - 1
If ListArray(i) <> "" Then
LastNonEmpty += 1
ListArray(LastNonEmpty) = ListArray(i)
End If
Next
ReDim Preserve ListArray(LastNonEmpty)
Dim RetValue As String = ""
IF ListArray.Length - 2 > -1 Then
RetValue = ListArray(ListArray.Length - 2)
Else
RetValue = ListArray(ListArray.Length - 1)
End If
Return RetValue
End Function
Lets say I have data in Root\, but I have no data in Root\Certificates other than the file Root\Certificates\Some Company. The folder structure gets messed up because it doesn't register the parent child of Root Certificates since I no data is currently defined under that structure.
folderpath Root\ Root\Blacklist\ Root\Certificates\Some Company\ Root\Reports\ Root\Something Else\Some Company\
Is there a way I can just feed in the treeview nodes individually, or can someone think of a way to parse some of these and keep the structure? Any help would be very appreciated. :)