public void RefreshGrid() { try { if (localDataContext == null) { localDataContext = new LocalDataEntities(Properties.Settings.Default.LocalConnectionString); localDataContext.DetectChanges(); } bindingSource.DataSource = localDataContext.EDMApplications; foreach (var fieldName in new string[] {"Id", "UserMenuOptions", "Users"}) { var col = viewItems.Columns.ColumnByFieldName(fieldName); if (col != null) { col.Visible = false; col.OptionsColumn.ShowInCustomizationForm = false; } } btnSave.Enabled = false; btnDelete.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void RefreshGrid() { try { if (localDataContext == null) { localDataContext = new LocalDataEntities(Properties.Settings.Default.LocalConnectionString); localDataContext.DetectChanges(); } bindingSource.DataSource = localDataContext.EDMUsers; btnSave.Enabled = false; btnDelete.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }