Skip to content

Instantly share code, notes, and snippets.

@Zujaj
Created October 12, 2020 10:04
Show Gist options
  • Save Zujaj/bb5ae76cbb6ef842871d569123d61b11 to your computer and use it in GitHub Desktop.
Save Zujaj/bb5ae76cbb6ef842871d569123d61b11 to your computer and use it in GitHub Desktop.
Form Load Event of TestApp
private void TestAppForm_Load(object sender, EventArgs e)
{
// Invoke the method PopulateList using the person object
// Pass the personList as the parameter.
personObject.PopulateList(personList);
// Use morelinq ToDataTable extension for converting personList to DataTable.
// Assign the converted Datatable to BindingSource's DataSource.
personBindingSource.DataSource = personList.ToDataTable();
//Finally assign personBindingSource to DataGridView's DataSource.
dataGridView.DataSource = personBindingSource;
//Allow data filtering
EnableGridFilter(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment