vb,怎样显示文件内非txt的文件列表?

来源:百度知道 编辑:UC知道 时间:2024/05/02 07:55:42

拉一个列表控件 listbox --ID为FileList

FileList.Items.Clear()

Dim Path As String = "c:\"
For Each foundFile As String In My.Computer.FileSystem.GetFiles(Path, FileIO.SearchOption.SearchTopLevelOnly, "*.*")
'再次确保文件存在
If My.Computer.FileSystem.FileExists(foundFile) = True Then
Dim LastName As String = My.Computer.FileSystem.GetFileInfo(foundFile).Extension.Replace(".", "")
If LastName <> "txt" Or LastName <> "text" Then
FileList.Items.Add(foundFile.ToString)
End If
End If
Next

啥意思?没明白