private void UnbindBindingSource(BindingSource source) { System.ComponentModel.IEditableObject current = this.dataListBindingSource.Current as System.ComponentModel.IEditableObject; this.dataListBindingSource.DataSource = null; if (current != null) { current.EndEdit(); } }
protected void UnbindBindingSource(BindingSource source, bool apply, bool isRoot) { System.ComponentModel.IEditableObject current = source.Current as System.ComponentModel.IEditableObject; if (isRoot) { source.DataSource = null; } if (current != null) { if (apply) { current.EndEdit(); } else { current.CancelEdit(); } } }