Here is the code I'm using with some minor code left out:
PARAMETERS tcPath, tnLevel, tnCount
LOCAL laDirArr[1,1],i,lnTotDir,lnLvl,lnCount,lpkey
LOCAL oTreeView,oNode
LOCAL lcDirectoryName
* Add Items To TreeView Control
lnLvl = lnLvl + 1
lnCount = lnCount + 1
lpKey = LOWER(SUBSTR(tcPath,1,RAT("\", tcPath, 2))) + "_"
oTreeView = ThisForm.tv_DirectoryTree
IF lnCount = 1
oNode = oTreeView.Nodes.Add( , 1, Lower(tcPath) + "_", Lower(tcPath),,)
oNode.Image = "Fixed"
ELSE
lcDirectoryName = SUBSTR(tcPath,RAT("\",tcPath,2) + 1)
lcDirectoryName = SUBSTR(lcDirectoryName,1,LEN(lcDirectoryName)-1)
oNode = oTreeView.Nodes.Add(lpKey, 4, Lower(tcPath) + "_",;
Lower(lcDirectoryName),,)
oNode.Image = "CloseFolder"
ENDIF
Once I execute this code to fill the treeview I cannot properly release the form.
Terry Rooks
Software Systems Architect
Microsoft Certified Solution Developer.Net
If at first you don't succeed, then skydiving definitely isn't for you.