Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox DisplayValue

Status
Not open for further replies.

michaelkatz

Programmer
Sep 1, 2002
50
GB
I am using a dropdown combobox, style = 0.

I nedd to detect when the user enters something not in the list, (which is populated using the addlistitem method).

It appears that the displayvalue is not updating accurately.

For example: if the textbox portion contains 'hat' and the user keypresses an 'e', the displayvalue is not updated. It is still 'hat'. This is only happening for the first keystroke. after that it work fine.

The same thing happens if the user starts with an empty textbox portion.

Until the displayvalue is correct, the listindex is also inaccurate. I am finding it very difficult to test if the 'displayvalue' is in the list.

Help???

Michael
mkatzla@juno.com
 
You could add the following code in lostfocus of the combo box:

LOCAL lnLoop, llFound
llFound = .F.
WITH THISFORM.COMBO1
FOR lnLoop = 1 TO .LISTCOUNT
IF .VALUE = .LIST(lnLoop)
llFound = .T.
ENDIF
ENDFOR
ENDWITH
IF .NOT. llFound
= MESSAGEBOX("Not Found!")
NODEFAULT
ENDIF

 
You didn't mention what method you were in when you checked the DisplayValue property. If it was in the InteractiveChange method, that's too soon in the event model to pickup the change. You need to check this in the valid method.



-BP
 
Both replies I received are helpful and informative. I was checking the value in the InterAciveChange method. They both seem to agree that the IC method is too soon to check.

I am still trying to figure out why everything works fine after the first keystroke. The IC method reports the correct value starting with the second keystroke.

Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top