主题:vb.net问题。怎么定义Directoryinfo类?
Private Function listDir(ByVal CurrentDir As String) As Boolean
Dim thisdir As New Directoryinfo(CurrentDir)
TextBox2.Text = ""
If thisdir.exists Then
Dim subdirectories As Directoryinfo()
subdirectories = thisdir.getdirectories
With thisdir
TextBox2.Text = "跟路径:" & .Root.tostring() & vbCrLf & _
"属性 :" & .Attributes.tostring & vbCrLf & _
"<目录列表>" & vbCrLf & _
"文件名".PadRight(28, "-") & "创建文件日期".PadRight(16, "-") & vbCrLf
End With
Dim subdir As Directoryinfo
For Each subdir In subdirectories
TextBox2.Text &= subdir.name.padright(30) & _
subdir.creationTime.tostring("d").padleft(20) & vbCrLf
Next
Return True
Else
Return False
End If
End Function
----------------------------------------
显示的是Directoryinfo未定义。是怎么回事呀?怎样解决啊?
Dim thisdir As New Directoryinfo(CurrentDir)
TextBox2.Text = ""
If thisdir.exists Then
Dim subdirectories As Directoryinfo()
subdirectories = thisdir.getdirectories
With thisdir
TextBox2.Text = "跟路径:" & .Root.tostring() & vbCrLf & _
"属性 :" & .Attributes.tostring & vbCrLf & _
"<目录列表>" & vbCrLf & _
"文件名".PadRight(28, "-") & "创建文件日期".PadRight(16, "-") & vbCrLf
End With
Dim subdir As Directoryinfo
For Each subdir In subdirectories
TextBox2.Text &= subdir.name.padright(30) & _
subdir.creationTime.tostring("d").padleft(20) & vbCrLf
Next
Return True
Else
Return False
End If
End Function
----------------------------------------
显示的是Directoryinfo未定义。是怎么回事呀?怎样解决啊?