MiserableMad
Active member
- Joined
- Feb 2, 2007
- Messages
- 25
- Programming Experience
- Beginner
This is the code I have...
The trouble is when ever it loops, it only returns one value(desktop.ini)
What am I doing wrong?
The trouble is when ever it loops, it only returns one value(desktop.ini)
VB.NET:
Try
Const beginPath As String = "C:\Documents and Settings\"
Const endPath As String = "\Local Settings\Temporary Internet Files"
Dim fullPath As String = beginPath & Environment.UserName.ToString & endPath
'Count the number of files
Dim counter As Integer
lstTemp.Items.Clear()
Dim list As New IO.DirectoryInfo(fullPath)
Dim file As IO.FileInfo() = list.GetFiles
Dim fi As FileInfo
For Each fi In file
lstTemp.Items.Add(fi.FullName.ToString)
counter += 1
txtCounter.Text = counter
txtCounter.Update()
Next
'put in alhpa numeric order
lstTemp.Sorted = True
Catch ex As Exception
MsgBox(ex.Message, , Me.Text)
End Try
What am I doing wrong?