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();
      }
   }
}
commented: he helped me alot +1

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.