- void loadData()
- {
- dt = new DataTable();
- dt.Columns.Add("Country", typeof(string));
- dt.Columns.Add("Sales", typeof(int));
-
- dt.Rows.Add(new object[] { "Argentina", 2000 });
- dt.Rows.Add(new object[] { "Belgium", 4500 });
- dataGridView1.DataSource = dt;
- }
I need to use BindingSource class to filter data and i dont know how else i can do it so that I have columns added from the designer and am able to filter datagrid. https://stackoverflow.com/questions/63245000/filter-datagrid-view-from-data-populated-from-entity-in-c-sharp is the post that I had previously posted to get help on how to filter datagridview but the solutions seems is have to bind data using datasource. I need to maintain the style and format applied to the datagridview columns on the designer
I have created a datagridview in designer view and added columns to it. My question is how I can access these columns from my DataTable object instead of again manually adding columns to the Datatable again(Re use columns added from datagridview on Datatable). This is what have done so far