tags:

views:

141

answers:

1

Programming language is vb.net

A: 

You could extend the ListBox class and then override the part of the class that throws the Scroll event.

EDIT: Do you want the Scroll event not to be thrown or do you actually not want the ListBox itself to scroll?

This might work - I cant test it here tho... Also you'll need to port to vb.net

public class BetterListBox : ListBox { 
  // WM_VSCROLL message constants
  private const int WM_VSCROLL = 0x0115;
  protected override void WndProc(ref Message m) {
    // Trap the WM_VSCROLL message to generate the Scroll event
    if (m.Msg != WM_VSCROLL) {
       base.WndProc(ref m);
    }

}
anger
I do want the scroll event to be thrown after the keydown or keypress event
tushar
can you please provide me the code or explain it on how to extend the listbox class and override the appropriate event ?
tushar
You said you want to disable the scroll event in your question but then below you say you want the scroll event to be thrown? Can you explan your scenario a bit more clearly?
anger
Sorry I want to say I do not want the scroll event to be thrown after listbox keydown or keyup event
tushar
I have tried it but it is giving me errorsTwo Errors1) 'ListBox' is a 'namespace' but is used like a 'type'2) The type or namespace name 'Message' could not be foundand can you please provide the same in vb.net
tushar
Dont have Visual Studio anymore sorry can't help you
anger
tushar
any help please
tushar