>Actually what I'm trying to do with the combobox is,
>1. dropped down on got focus event
>2. enabled enter any value on the text area of combobox (style=2)
>3. incremetal search for the value added on text area with the list dropped down
>4. if the value doen't exist then addlistitem(newitem)
>
>And....
>the problem is, I can't do no.2 (with the listbox dropped down), is there any possible way that I can enter any value in the text area of combobox even if the value is not on the list ? (incremental search already set to .F., but still it works the same way)
>
>Hope there's someone can help me with this.
>
>
>Thanks
Hi Senna.
You have to change the style of rthe list to 0 - drop down combo the be able to add new items to it. Then, you can put code like this into the valid method of the combo:
LOCAL lnALen, lnAnswer, lcSelect
lcSelect = THISFORM.PrimaryTable
lnAnswer = 7
IF This.Value > 0
ELSE
IF ASC(THIS.DisplayValue) = 12
THIS.DisplayValue = ""
ELSE
IF !EMPTY(This.DisplayValue)
lnAnswer = Messagebox("Do you want to add "+alltrim(This.displayvalue),32+4)
IF lnAnswer = 6
SELECT ClntType
lnRetVal = GetKey("ClntType", "Cl_Type")
IF (lnRetVal = 0) OR (lnRetVal > 2147483646)
SELECT (lcSelect)
RETURN .F.
ELSE
SELECT ClntType
APPEND BLANK
REPLACE Cl_Type WITH lnRetVal, ;
TypeDesc WITH THIS.DisplayValue
=TABLEUPDATE()
THIS.Requery()
THIS.Value = lnRetVal
THIS.Refresh()
RETURN .T.
ENDIF
ELSE
SELECT (lcSelect)
RETURN .T.
ENDIF
ENDIF
ENDIF
ENDIF
Hope this helps.
Marcia