I think I have The Answer of my question
I added a DataGridViewLinkColumn to the DataGridView
now the next step will fill the Data into the datagridview
and the File names will appear like links:
private void button1_Click(object sender, EventArgs e)
{
string[] SS = new string[3];
SS[0] = "C:\\test1.txt";
SS[1] = "C:\\test2.txt";
for (int i = 0; i < SS.Length; i++)
{
dataGridView1.Rows.Add(SS[i]);
}
dataGridView1.Refresh();
}
The Last step :
now I want to open the file when the user click it
I will use the "CellContentClick" event and this code will achieve it:
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string filepath= (string)dataGridView1.Rows[e.RowIndex].Cells[0].Value;
System.Diagnostics.Process.Start(filepath);
}