Results 1 to 3 of 3

Thread: vanishing ListIndex

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    Somewhere in war torn Israel
    Posts
    51

    vanishing ListIndex

    Hi,
    I've created an ActiveX combo control that behaves like an Access combo - when typing text into it it finds the closest matching entry from the list and highlights the auto-completed text so that the user can continue typing.
    When I assign it a string through code it works like a dream (at the end of the process I'm left with the right ListIndex).
    The problem is that after I type a char into it, it finds the right entry (and assign the right ListIndex to the ActiveX internal combobox), but once its out of the code module that doe's the search it loses the ListIndex and it defaults to -1!
    I've gone through the code few times and don't understand how come when assigning strings by code all is good but when typing it doesn't work even though the same code is called (from the ActiveX's combobox_Change event).

    Help would be appreciated.
    Thanx

  2. #2
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628
    Well ComboBoxes ListIndex(s) are -1 when nothing is selected, is it possible that when you are matching items in your combo box that you never actually select the item it is matching too?. So if in code it is finding it in code, try being redundant and setting it explicitly...
    VB Code:
    1. Dim ind as Integer
    2.    'Code locates right index ( I am assuming from what you said)
    3.    ind=Combo1.ListIndex
    4.  
    5.   'At end of all code processing
    6.   Combo1.ListIndex=ind
    Either way it is not actually selecting the item your matching in code is the bottom line. Or if you are finding the match by string comparison and getting the matches ListIndex then you need to do an explicit assignment.

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    Somewhere in war torn Israel
    Posts
    51
    thats not the case I'm afraid. The list item is found using an API call and the List Index is set accordingly.
    Thanx though

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