
FileList = My.Computer.FileSystem.GetFiles("PathOfFile", FileIO.SearchOption.SearchTopLevelOnly, "*.txt")
'Iterate the list of files
For Each File In FileList
'Make a copy of the new file name
ToFile = File.Replace(".txt", ".doc")
'Rename the file
My.Computer.FileSystem.RenameFile(File, ToFile)
'Move on to the next file.
Next