SkabelonerListbox.DeleteAllRows
Dim f As FolderItem
f = SelectFolder
Dim filecount As Integer = f.Count
For i As Integer = 1 To filecount
If f.Directory Then
SkabelonerListbox.AddRow(f.item(i).name)
Else
MsgBox("Du har ikke valgt et bibliotek")
End if
Next
Then I get filenames i the selected folder and only sufolders in the folder.
If I wan’t the subfolder/filename shown instead of only subfolder, how to do then?
SkabelonerListbox.DeleteAllRows
Dim f As FolderItem
f = SelectFolder
Dim filecount As Integer = f.Count
For i As Integer = 1 To filecount
If f.Directory Then
if Right(f.item(i).name , 3)=".ft" or Right(f.item(i).name , 4)=".htm" then
SkabelonerListbox.AddRow(f.item(i).name)
End if
Else
ListFiles (f.absolutepath)
End if
Next
And a Sub rutine:
if theFolder<>nil then
if theFolder.Directory then
for i as Integer=1 to theFolder.Count
if theFolder.Item(i).Directory then
ListFiles(theFolder.Item(i))
else
listbox3.addrow theFolder.Item(i).name
end if
next
end if
end if
But that just give me this error:
Window1.TilføjButton.Action, line 15
Parameter “theFolder” expects class FolderItem, but this is type String.
End if
Dim theFolder As New FolderItem
theFolder = Selectfolder
If theFolder Is Nil Then
Return
End If
Dim count As Integer = theFolder.Count
For i As Integer = 1 to count
Dim f As FolderItem = theFolder.Item(i)
If f <> Nil Then
If f.Directory = false then
If Right(f.Name , 3)=".ft" or Right(f.Name , 4)=".htm" then
SkabelonerListbox.AddRow(f.Name)
End if
else
ListFiles(f)
End if
End If
Next[/code]
and then I have this ListFiles under methods:
Dim count As Integer = theFolder.Count
For i As Integer = 1 to count
Dim f As FolderItem = theFolder.Item(i)
If f <> Nil Then
if f.Directory = false then
If Right(f.Name , 3)=".ft" or Right(f.Name , 4)=".htm" then
SkabelonerListbox.AddRow(f.Parent.Name + "/" + f.Name)
End if
else
ListFiles(f)
end
End If
Next