I\'m trying to read the content of an excel file (I must process the data not show it) but the number of rows is 0. I did show the data in the UI and the rows didn\'t have a num
try this:
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = resultDt;
in your case:
bindingSource.DataSource = ds.Tables[0];
and:
dgResult.DataSource = bindingSource;
flowLayoutPanel.Controls.Add(dgResult);
var c = dgResult.Rows.Count;
The binding source is what's responsible for syncing your data with the control. You want to use it, rather than trying to assign the table directly to the control.
Reference:
Datagridview rowcount showing 0 even when there is a valid datasource