I am using the following code to search for a specific file with .doc extension.
How can I get this info into a variable to be used later?
Dim di As New DirectoryInfo("d:\")
Dim files() As FileInfo = di.GetFiles("*.doc", SearchOption.AllDirectories)
You already do have the info, in your files() array.
You can then use files() array to get a count of matches
files.Length, or iterate through the matching filesforeach file as FileInfo in files {}.