'C# DataGridView Binding to table inop
Trying to display table data in a data grid view. Have followed many blog suggestions with no resolution. Have reduced the code down to the simple test case below but grid view remains blank. Last check grid view Rows = 0. (not verified again for this exact code but still blank).
private void ImportTable(string fileName)
{
DataTable table = new DataTable();
table.Columns.Add("Column 1", typeof(int));
table.Columns.Add("Column 2", typeof(int));
table.Rows.Add(1, 2);
dataGridView1 = new DataGridView();
dataGridView1.AutoGenerateColumns = true;
BindingSource SBind = new BindingSource();
SBind.DataSource = table;
dataGridView1.DataSource = SBind;
dataGridView1.Refresh();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
