Friday, October 12, 2007

Getting a List of Storage Card Directories for Smartphone and Windows Mobile

There are lots of example of getting a list of Storage Card directories for Windows Mobile and Smartphone out there. He is one that I have cobbled together from the other example in VB.NET.

Other references that include C# examples are:

Imports System.IO

Public Function GetStorageCardNames() As String()


Dim attrStorageCard As FileAttributes = FileAttributes.Directory Or FileAttributes.Temporary
Dim scards As New ArrayList()
Dim rootDir As New DirectoryInfo("\")

For Each di As DirectoryInfo In rootDir.GetDirectories()

If (di.Attributes And attrStorageCard) = attrStorageCard Then
End If


Return CType(scards.ToArray(GetType(String)), String())

Catch ex As Exception

Return Nothing

End Try

End Function

No comments: