Skip to content

Instantly share code, notes, and snippets.

@joebuschmann
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save joebuschmann/3aaf386381926ad90cd3 to your computer and use it in GitHub Desktop.

Select an option

Save joebuschmann/3aaf386381926ad90cd3 to your computer and use it in GitHub Desktop.
Override Form.ProcessDialogKey to suppress automatic handling of accept button
protected override bool ProcessDialogKey(Keys keyData)
{
// Suppress the accept button when the filter editor has the focus.
// This doesn't work in the KeyDown or KeyPress events.
if((keyData == Keys.Return) && (filterEditor.ContainsFocus))
return true;
return base.ProcessDialogKey(keyData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment