Note: in converting my long untidy code into pseudo-code I have not explained that I want to return an array/list that contains the data that as been loaded into arFiles. That is what line... // look at the contents of each file and store selected information in
means.
I have simple form with a button to load a directory of files and scan them and load an array with the selected data at runtime. How do I load the dataGridView1 with the contents of an array?
I have searched the web and cannot find a method to do it at runtime. The examples I have seen assume one is loading static data.
Please be gentle with me as I have not coded for approx 10 years.
private void btnReadLogFiles_Click(object sender, EventArgs e)
{
    string[,] arFiles;
    arFiles = this.getFileInfo();
    // watch window shows arFiles is loaded correctly
    // how do I load a dataGridView1 with the data from the array at runtime?
}
private string[,] getFileInfo()
{
    string[] oFiles = Directory.GetFiles(sPath, "*.csv");
    nColumns = 4;
    nRows = Directory.GetFiles(sPath, "*.csv").Length;
    // create an array of rows that matches the files in the directory
    string[,] arFiles = new string[nRows, 4];
    // look at the contents of each file and store selected information in arFiles.
    return arFiles;
}
 
    
 
    