Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox value resets to blank
Message
From
23/11/2013 08:14:35
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 5
OS:
Windows XP SP3
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01588496
Message ID:
01588546
Views:
113
Hi Brad,

I've found that these combo boxes work best with arrays.
Use your sql statement to populate an intrinsic array like this.ialist,
then when you type something not in the array into the box, re-dim the
array and insert the value with code something like this:

local lctext,lcexact,lnarrlen

lctext=iif(empty(this.value),alltrim(this.text),alltrim(this.value))
lcexact=set("exact")
lnarrlen=0

set exact on
with this
if !empty(lctext)
if ascan(.ialist,lctext)=0
lnarrlen=alen(.ialist)+1
dimension .ialist[lnarrlen]
ains(.ialist,1)
store alltrim(lctext) to .ialist[1]
.numberofelements=lnarrlen+1
endif
* if alltrim(this.text)!=lctext
this.value=lctext
* endif
endif
endwith
set exact &lcexact
return

The combo box will see the new value in its list and display it. Otherwise, it just ignores it.

Luke
Previous
Reply
Map
View

Click here to load this message in the networking platform