Hi,
Im trying to do a simple search of files of a certain type on a pocket pc. I pulled the code below off the internet but keep getting a DirectoryNotFoundException on the New DirectoryInfo(Directory) line. Although Ive got "\Storage Card" on this example Ive tried it with \Program Files and various other folders that are always there. It fails both on the emulator and on the device itself.
Any clues on what Im doing wrong would be greatfully appreciated
Thanks
Dave
Im trying to do a simple search of files of a certain type on a pocket pc. I pulled the code below off the internet but keep getting a DirectoryNotFoundException on the New DirectoryInfo(Directory) line. Although Ive got "\Storage Card" on this example Ive tried it with \Program Files and various other folders that are always there. It fails both on the emulator and on the device itself.
Any clues on what Im doing wrong would be greatfully appreciated
Thanks
Dave
Code:
Try
Dim di As DirectoryInfo = New DirectoryInfo("\Storage Card")
Dim dirs As DirectoryInfo() = di.GetDirectories()
Dim s As String() = Directory.GetFiles("*.tga")
ListBox1.Items.Add("Number of guides on storage card is " & s.GetLength(0))
ListBox1.Items.Add("Number of directories on card is " & dirs.Length)
Dim diNext As DirectoryInfo
For Each diNext In dirs
ListBox1.Items.Add("The number of guides in " & diNext.Name & " with is " & diNext.GetFiles("*.tga").Length)
Next
Catch ex As Exception
MessageBox.Show("The process failed: " & ex.ToString())
End Try