Anybody knows how to make this works:
“Can be configured to let search trigger instantly when typing.
Can be configured to let search trigger time delayed when typing. (Usually gives best user experience)
Can be configured to let search trigger by enter key or click on search icon.”
I can’t find an item that seems fit from the list (press [Tab] after “me.”, and I tried me.SendSearchStringImmediately=false)
I use this inside the Search Event of my search control i.e. the user has pressed returned or the search control is blank:
if me.Text = "" then
'refresh the ListBox from scratch
'remove the rows not containing the search control text
This way there is minimal programming and the user is in control.
If you want it to trigger as you type then use the TextChange Event and search for Key types I don’t like this in case I mistype and press the delete key.
If you want to trigger a search based on the time delay then you will need a separate variable and Timer where you keep the initial Ticks and compare it with the current ticks, resetting the intial Ticks as the current Ticks if they ever press a key. Then, when (CurrentTicks - InitialTicks)/60 > 4 seconds then the Timer performs a search. Turn off the Timer when the user exits the Search control.
What are you trying to do? Do you want to search if the control loses focus (i.e. after TAB to next control)? Why not just use the LostFocus event?
Yes, put the code in LostFocus event will do. Sometimes you will drill into wrong direction and missed those simple solutions. Thanks all.