Results 1 to 2 of 2

Thread: Prevent index change in list box on keypress

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    63

    Question Prevent index change in list box on keypress

    Hello Everyone,

    I'm having a problem with my listbox control. I am trying to handle all the keypress events for the listbox and changing the index to the item I want as they type. But the problem is the listbox changes the index to the last key they hit.

    Here is what's going on.

    listbox items example

    Car
    Cop
    Man
    Open

    I type C and Car is selected. I continue typing O and I programatically select the Cop but after I do that VB takes over somehow and selects Open. I need to stop this. how can I disable VB changing the listbox to the last key pressed?

    Thanks for all your assistance.

    Mythos.

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    63

    Re: Prevent index change in list box on keypress

    Well I found a way around it by setting a variable to the index I changed to and on selectedindexchange I check to see if the selected index matches my variable and if it doesn't then i set it to my index again.

    If there is a better way than this please let me know

    thanks again

    Mythos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width