Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids and List Boxes
Message
From
01/06/1998 16:50:03
 
 
To
01/06/1998 15:32:21
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00103642
Message ID:
00103785
Views:
21
Hi Trish ---

Yes there is: Read from MS KB:

How To Use the BoundTo Property to Store Numeric Values
Last reviewed: January 10, 1997
Article ID: Q156179
The information in this article applies to:
Microsoft Visual FoxPro for Windows, version 5.0

*** BTW, forget the VFP3 reference...it also applies to 5 as shown above

SUMMARY
In Visual FoxPro 3.0, when the ControlSource property of a combo box or list box evaluates to a numeric value, the ControlSource property stores the index number (position) in the list instead of the actual numeric value that is displayed. However, a new property named BoundTo has been introduced in Visual FoxPro 5.0 to solve this problem.



MORE INFORMATION
The RowSource property of a combo box or list box specifies the source of the values; that is, it indicates where the data is coming from.

The ControlSource property of a combo box specifies the data that is modified when a selection is made. It indicates where the data is going to.

When a combo box or a list box is bound to a ControlSource property with character data type, the character value is stored to the ControlSource property as it shows in the list. However, if it is bound to a ControlSource property with numeric data, the numeric value stores differently, depending on the setting of the BoundTo property. Below is a step-by-step example that shows you how to store the actual numeric value to the ControlSource property of a combo box or a list box:


Create a new form.

On the View menu, click Data Environment, then add the \Samples\Data\Orditems table to the DataEnvironment object.

Add a combo box control to the new form, then set combo box properties as follows:


RowSource = 10,20,30,40,50,60,70,80,90,100
RowSourceType = 1-Value
ControlSource = orditems.quantity
BoundTo = .T.

Save and Run the form.

Now, when you click any item in the combo box, the actual numeric value stores to the quantity field. You can verify this by browsing the orditems table while you are making changes to the combo box.
However, if you set the BoundTo property to .F., the index number (position) of the list is stored to the quantity field instead.





>I'm sorry...combobox as a drop down list.
>
>VFP 5.0
>
>Is there a solution?
>
>
>>There is/was? a problem using numerics as the bound column in Comboboxes in that the value will return as an index value and not the actual number....are you sure you're not using a combobox? And what version of VFP are you running?
>>
>>
>>>I am having a problem with a list box in a grid.
>>>
>>>callpurp (code n(3),descript c(30))
>>>
>>>rowsource: callpurp.descript,code
>>>rowsourcetype: 6
>>>boundcolumn: 2
>>>bound: .t.
>>>
>>>
>>>The grid shows the correct information until I select the list box and then it highlights the first one in the list. There is something not set right and I can't figure it out.
>>>
>>>Thanks.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform