Reputation: 357
I have a regular datatable created, it exports and imports into xml and everything is fine.
To make easy its acess, i created a datagridview, and i'm trying to make the dataatable content available there
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
dataGridView1.DataSource = DataAccess.Instance.tabelaEC0;
}
(i got the table created in a different class so it would be available to all forms)
all i get is a empty gridview
Upvotes: 0
Views: 143
Reputation: 778
Here is an example of setting a DataSource on DataGridView. DataSet1 is a typed dataset with one table "DataTable1" having one string column:
DataSet1 ds = new DataSet1();
ds.DataTable1.AddDataTable1Row("test");
dataGridView1.DataMember = "DataTable1";
dataGridView1.DataSource = ds;
Alternatively you can bind a table as DataSource:
DataSet1 ds = new DataSet1();
ds.DataTable1.AddDataTable1Row("test");
dataGridView1.DataSource = ds.DataTable1;
Upvotes: 1