protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); if (_editBox == null) { return; } // if the user clicks away, then we infer if the user meant to accept or cancel // based on if the user has actually typed into the control if (_hasChanges) { _editBox.Accept(); } else { _editBox.Cancel(); } }