protected override void OnKeyPress(KeyPressEventArgs e) { CustomPopupLookUpEditForm form = this.PopupForm as CustomPopupLookUpEditForm; if (lastChar == "backspace") { e.Handled = true; form.IncrementalSearchText = form.IncrementalSearchText.Remove(form.IncrementalSearchText.Length - 1); } base.OnKeyPress(e); if (lastChar != "backspace") { form.IncrementalSearchText += lastChar; } }
protected override void OnPreviewKeyDown(System.Windows.Forms.PreviewKeyDownEventArgs e) { CustomPopupLookUpEditForm form = this.PopupForm as CustomPopupLookUpEditForm; base.OnPreviewKeyDown(e); if (char.IsLetterOrDigit((char)e.KeyCode)) { lastChar = ((char)e.KeyCode).ToString(); } else if (e.KeyData == Keys.Back) { lastChar = "backspace"; } else { lastChar = ""; } }