Hi i need to view all files with their names and icons From a specific directory in a grid style inside my c# winform app

Any help would be appreciated
Thank you for your time

Let's say you have a directory c:\science with some .txt files in it.

You can put a DataGridView on your form and fill it like this:

using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace DW_404491_CS_FORM
{
   public partial class Form1 : Form
   {
      public Form1()
      {
         InitializeComponent();
      }

      private void Form1_Load(object sender, EventArgs e)
      {
         dataGridView1.DataSource =
         (
            from dir in Directory.GetFiles("c:/science/", "*.txt")
            select new
            {
               FileName = Path.GetFileName(dir.ToString())
            }
         ).ToList();
      }
   }
}
Comments
he helped me alot

Thank you it helped me alot but does this also work with shortcuts instead of real files

I did not test it with .lnk files.
All I can say is put some links in the target directory and test it.

This question has already been answered. Start a new discussion instead.