Imports System.IO Module Module1 Sub Main() Dim fileList(9) As String For Each file As String In Directory.GetFiles(".", "*.txt", SearchOption.TopDirectoryOnly) Dim fileNumber As Integer Dim fileName As String = Path.GetFileNameWithoutExtension(file) If fileName.StartsWith("g") AndAlso Path.GetExtension(file) = ".txt" AndAlso Integer.TryParse(fileName.Substring(1), fileNumber) AndAlso 0 <= fileNumber AndAlso fileNumber <= 9 Then Using sr As New StreamReader(file) fileList(fileNumber) = sr.ReadToEnd() sr.Close() End Using End If Next End Sub End Module