Skip to main content

Recent Files - Display in VB.NET

Today, I will teach you how to create a recent files to be displayed in the ListView in VB.NET.

Now, let's start this tutorial!

1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.

2. Next, add one listview named listViewrecentfiles with three columns namely Item name, Date Created, and Name of the file, and one button also named button1checkrecent. Insert ImageList with some images that you wanted to use. You must design your interface like this:


3. Now, we will do the coding.

We will import the following libraries below to access the component model and diagnostics.

  1. Imports System.IO, System.Diagnostics, System.ComponentModel

Then we will find the recent folder path. Use the code below:

  1. Dim RecentFolderPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Recent)

For our button, put this code below:

  1. Private Sub button1checkrecent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1checkrecent.Click
  2. listViewrecentfiles.Items.Clear()
  3. Dim lstitem As New ListViewItem()
  4. imageList1.Images.Clear()
  5. For Each RecentFile1 In Directory.GetFiles(RecentFolderPath)
  6. imageList1.Images.Add(RecentFile1, Icon.ExtractAssociatedIcon(RecentFile1))
  7. 'add file and its icon
  8. lstitem = listViewrecentfiles.Items.Add(RecentFile1, RecentFile1)
  9. 'add created date
  10. lstitem.SubItems.Add(New FileInfo(RecentFile1).CreationTime.ToLongDateString())
  11. 'add only name without extension
  12. lstitem.SubItems.Add(Path.GetFileNameWithoutExtension(RecentFile1))
  13. Next
  14. End Sub



For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.

Best Regards,

Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]

Visit and like my page on Facebook at:

Subscribe at my YouTube Channel at: Ser Bermz

Visit my website at:

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.