We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Intercept listbox key behavior

Thread ID:





2831 Feb 16,2003 11:10 AM Feb 19,2003 06:30 AM Windows Forms 3
Tags: FAQ
David Whatley
Asked On February 16, 2003 11:10 AM

When a listbox control has focus and a a key is pressed, it tries to select the item that matches that keystroke. I'd like to have it not do this at all in one particular place, but I cannot figure out how. Is there an easy way to disable this behavior. I tried wiring to the keydown event (and doing nothing with it), but that doesn't seem to help. I'm sure it's simple... just not seeing it. :) - David

Administrator [Syncfusion]
Replied On February 17, 2003 07:34 AM

The listbox control probably does this in it's OnKeyDown method (before firing the KeyDown event) or in ProcessCmdKey method. Try overriding OnKeyDown and not call the base class in a derived class, this will prevent all keydown processing in the listbox control. If that doesn't work try overriding ProcessCmdKey. -Praveen

Replied On February 17, 2003 02:23 PM

You mean I have to create my own control type by inheriting from one of theirs? -- David

Ramesh Praveen [Syncfusion]
Replied On February 19, 2003 06:30 AM

Yes, that is what I meant. -Praveen


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.