how do you convert a directoryInfo file to string
Problem is that i cant convert to string
Dim path As String = "..\..\..\Tier1 downloads\CourseVB\"
If countNumberOfFolders > 0 Then 'if there is a folder then
' make a reference to a directory
Dim di As New IO.DirectoryInfo(path)
Dim diar1 As IO.DirectoryInfo() 开发者_运维技巧= di.GetDirectories()
Dim dra As IO.DirectoryInfo
'list the names of all files in the specified directory
For Each dra In diar1
Dim lessonDirectoryName() As Lesson
lessonDirectoryName(0).lessonName = dra
Next
'the the lesson is an object, and lessonName is the property of type string. How do i convert the directoryInfo to string?
DirectoryInfo has a FullName property which is the path of the directory as a string.
Your comments conflict with your code and your code looks a little bit buggy. I think you want something like:
Dim lessonDirectoryNames As New List(Lesson)
If Directory.Exists(path) Then
For Each fileName as String In Directory.GetFiles(path)
Dim les as New Lesson
les.lessonName = fileName
lessonDirectoryName.Add(les)
Next
End If
精彩评论