>I would like to use a dropdown listbox to give the user a choice of entries for a field. I have done this in many other places in my app, but until now had no reason to make the control read-only. Now I can't get it to behave. Setting the control read-only has no effect on it. There must be something else going on with the box that makes it want to stay editable. I have another issue that my go hand in hand with this one. The field that I am using this control to fill in currently has some values in it that I would like for the Listbox to be able to display, but not let the user choose from in the future... they are obsolete values. Is there a way to allow the box to display them withouth having them as choices?
>
>Erik
Presumably you have some property set to determine whether the form is read-only or editable.
1. In the WHEN method of your listbox/combo add the code
IF thisform.NoEdit
return .f.
ELSE
return .t.
ENDIF
This will disable the combo completely.
2. In the Valid or LostFocus event add the code
IF thisform.NoEdit
This.value = oldval(combofield)
ELSE
ENDIF
This method has the advantage of allowing users to SEE the list but any changes simply won't be kept.
As for List vs Combo, it's a matter of taste. Usually (as per Ed Pikman) we use combo for all of the drop-down forms and Listbox for the always-open version. But the docs DO split the dropdown as you said.
HTH
Barbara