>My client wants to enter a value in a cbo that is not in the rowsource list, ...and not have it in the list in the future. So far the bahavior I'm seeing is you lose the value when the cbo loses focus. I assume because the value is not in the list. I also have continual headaches getting displayvalue or value to show up at init time. Where is the best place to set the value for displayvalue and value at runtime so it will be there when the form is open?
>
>Eric K.
Eric, this is the code from my combo of similar type.
In this partucular case I have the RowSource = 1 - Value and the combo.Value property has the expression "= myAlias.Description"
dodefault()
local lItemExists
lItemExists = .F.
FOR i = 1 to THIS.ListCount
IF THIS.List(i) = ALLTRIM(THIS.Value)
lItemExists = .T.
EXIT
ENDIF
ENDFOR
IF !lItemExists
local lcNewValue
lcNewValue = THIS.Value
THIS.AddItem(lcNewValue)
THIS.DisplayValue = lcNewValue
this.displayValue = this.Value
ENDIF
local lItemExists
lItemExists = .F.
FOR i = 1 to THIS.ListCount
IF THIS.List(i) = ALLTRIM(THIS.Text)
lItemExists = .T.
EXIT
ENDIF
ENDFOR
IF !lItemExists
local lcNewValue
lcNewValue = THIS.Text
THIS.AddItem(lcNewValue)
THIS.DisplayValue = lcNewValue
ENDIF
HTH,
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison