Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo Boxes
Message
From
19/05/1997 16:30:33
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, United States
 
 
To
19/05/1997 16:09:53
Holly Clawson
Travelcenters of America
Westlake, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00032834
Message ID:
00032852
Views:
39
>>>Help, I have a combo box, when selecting a control I hide the combo and display a text box. The text box is keeping whatever was contained in the combo. How do I clear this text box? I already do a refreash, and the text box does have the same control source as the combo box.
>>>
>>>Thank you
>>>
>>>
>>>Holly Clawson
>>
>>Holly,
>>
>>Why are you doing that? It sound like odd screen behavior... If you define the combobox as a combobox instead of a listbox, you should be able to get the same effect as what you're programming. But, if I'm off the mark..
>>
>>Don't use a control source for one of them. Either build an array for your combo, or set the .Value for the textbox programmatically. You should be able to set .Value for the textbox without doing a refresh.
>>
>>HTH
>
>Matt
>
>I agree, the reason for this is I have not been able to figure out how to key new entries into a combo box that has a rowsourcetype of fields. When you say value my value, is already set to none. Do you mean the controlsource type set-up programmatically? I tried that and none of my fields refresh().
>
>Thanx
>
>
>Holly

Don't use fields. I have a similar piece of code in my current app, here's how I solved it. If someone thinks I'm doing this ass-backwards, let me know.

I build an array from the field that the combo-box is based on and set the rowsourcetype to 5 and rowsource to the array (THISFORM.aArray). The controlsource is the field. (myTable.fieldA)

In the Valid for the combo, I evaluate the entry with a SELECT fieldA FROM myTable WHERE ALLT(THIS.DisplayValue) = fieldA INTO ARRAY laBuffer. On a single hit, I copy laBuffer to THISFORM.aArray and .Requery() and set .Value to .DisplayValue(1). On a multiple hit, I do the same array copy and give the user the option to select from a short list. On a no hit, I use oApp.doformretval() to call a 'NewRecord' class to enter a new record. (this last step depends on your application). Upon return, I set the .DisplayValue to the returned value (the control source).

For some reason, I couldn't get it to work with a SEEK(). But the functionality turned out to be more straightforward using a SELECT.

HTH
Matt McDonnell
...building a better mousetrap with moldy cheese...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform