General information
Category:
Coding, syntax & commands
Title:
How to Change a Combobox programatically
I have two dropdown comboboxes populated by cursors. The contents of the second combobox is a list of names dependent on the first. Sometimes a name will be in the second list when the first is changed, at other times it won't. When the name appears in the changed list, I want it to remain. When it doesn't appear, I want the value to be the first name in the list.
I can get the second list to always show the top name, or to always show the previous name (even when it is not in the requeried list) but I can't get it to behave as described above.
My current code is below, I've tried many combinations and I've left some of the lines (eg displayvalue etc) out, but I can't get the combobox value to show correctly. Can anyone tell me what's wrong with the code below?
Do MyProgram && SELECT THE CORRECT RECORDS FOR MYCURSOR
this.parent.combo.requery
sele mycursor
if reccount("mycursor")>0
locate for mynumfield=storedNumber
if .not. found()
go top
endif
m.control_source_variable=mycursor.myfield
this.partne.combo.value=mycursor.myfield
this.parent.combo.displayvalue=mycursor.myfield
endif
this.parent.combo.refresh
TIA
David O'Brien
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only