C# - Populate Datagridview With Files Name's

How To Fill DataGridView With Files Name From Folder Values On Another Form Using C#


In This C# Tutorial  We Will See How To Bind DataGridView File Name's Form Folder Using CSharp Programming Language.

Project Source Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
    public partial class DataGridView_With_Files_Name : Form
        public DataGridView_With_Files_Name()

        private void DataGridView_With_Files_Name_Load(object sender, EventArgs e)

            String[] files = Directory.GetFiles(@"C:\Users\samsng\Desktop\products");
            DataTable table = new DataTable();
            table.Columns.Add("File Name");

            for(int i = 0; i < files.Length; i++)
                FileInfo file = new FileInfo(files[i]);

            dataGridView1.DataSource = table; 



c# fill datagridview with file name's

Share this

Related Posts

Next Post »