public void UpdateGrid() { var db = IOController.GetContext(); switch (UIVars.TableName) { case "Customers": db.Customers.Load(); dataGridView.DataSource = db.Customers.Local.ToBindingList(); break; case "Sources": db.Sources.Load(); dataGridView.DataSource = db.Sources.Local.ToBindingList(); break; default: break; } }