Hi,
so in etwa funktioniert es!!!
Du mußt den Code für dich etwas anpassen, aber von der Sache her ist dies eine Möglichkeit wie man den View füllen kann. Es gibt sehr viele!!!!
Private Sub GetData(ByVal folder As String)
Try
If Not folder Is Nothing Then
Dim subdir As IO.DirectoryInfo, diFolder As New _
IO.DirectoryInfo(folder)
Dim file As IO.FileInfo, SubItemIndex As Integer = 0
Try
lvImgabelist.Images.Clear()
Me.lblaktDir.Text = folder
aktOrdner = folder
StartDir = Microsoft.VisualBasic.Left(folder, 3)
Dim Flength As Long
With ListViewFiles
.BeginUpdate()
.Items.Clear()
'Zuerst alle Ordner darstellen, falls vorhanden
For Each subdir In diFolder.GetDirectories()
Dim strUnterverzeichnisAttribute As String = _
subdir.Attributes.ToString
If InStr(strUnterverzeichnisAttribute, "Hidden") Or _
InStr(strUnterverzeichnisAttribute, "System") Then
'den entsprechenden Ordner nicht anzeigen
Else
.Items.Add(subdir.Name.ToString)
.Items(SubItemIndex).SubItems.Add("Dateiordner")
.Items(SubItemIndex).SubItems.Add("")
.Items(SubItemIndex).SubItems.Add( _
subdir.CreationTime.ToString("dd.MM.yy " & _
"HH:mm"))
.Items(SubItemIndex).SubItems.Add( _
subdir.LastWriteTime.ToString("dd.MM.yy " & _
"HH:mm"))
.Items(SubItemIndex).SubItems.Add( _
subdir.LastAccessTime.ToString("dd.MM.yy " & _
"HH:mm"))
.Items(SubItemIndex).SubItems.Add( _
subdir.Attributes.ToString)
Call AddImages(subdir.FullName, SubItemIndex)
.Items.Item(SubItemIndex).Tag = "Dateiordner"
SubItemIndex += 1
End If
Next
'Dann die Dateien
For Each file In diFolder.GetFiles()
Dim strFileAttributes As String
strFileAttributes = file.Attributes.ToString
'auf Attribute prüfen
If StrConv(InStr(strFileAttributes, "Hidden"), _
VbStrConv.Lowercase) _
Or StrConv(InStr(strFileAttributes, "System"), _
VbStrConv.Lowercase) _
Or StrConv(InStr(strFileAttributes, "ReadOnly"), _
VbStrConv.Lowercase) Then
'nicht sichtbare, schreibgeschüzte und System
' Dateien nicht auflisten
Else
.Items.Add(file.Name.ToString)
.Items(SubItemIndex).SubItems.Add( _
file.Extension.ToString)
Flength = file.Length.ToString
.Items(SubItemIndex).SubItems.Add(Umrechnen( _
Flength))
.Items(SubItemIndex).SubItems.Add( _
file.CreationTime.ToString("dd.MM.yy HH:mm"))
.Items(SubItemIndex).SubItems.Add( _
file.LastWriteTime.ToString("dd.MM.yy HH:mm"))
.Items(SubItemIndex).SubItems.Add( _
file.LastAccessTime.ToString("dd.MM.yy HH:mm"))
.Items(SubItemIndex).SubItems.Add( _
file.Attributes.ToString)
Call AddImages(file.FullName, SubItemIndex)
.Items.Item(SubItemIndex).Tag = "Datei"
SubItemIndex += 1
End If
Next
Me.tbbtnDirUp.Enabled = (StrConv(folder.ToString, _
VbStrConv.Lowercase) <> StrConv(StartDir, _
VbStrConv.Lowercase))
.EndUpdate()
End With
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation)
End Try
End If
Catch ex As Exception
'MsgBox(ex.Message, MsgBoxStyle.Exclamation)
End Try
End Sub Gruss
VIVAX
}
}
}
1:0 für Visual Basic.NET
|