Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComboBox
Message
From
05/04/2003 16:50:46
 
 
To
05/04/2003 14:17:02
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00774452
Message ID:
00774482
Views:
16
Hello Matthew.

The cmbo_Item column is currently bound to 1 (Desc) and the controlsource is set to items.Id.

In addition to what Sergey said, it appears from your description of the problem that you have the combo's BoundColumn set as 1. You need to set the BoundColumn to 2 in order to have this work correctly.

Just in case you are interested, the BoundTo and BoundColumn properties determine how the combo gets its value. The value of a combo or list box is taken from the column of its internal list that is specified by its BoundColumn. A combo box's DisplayValue, the value that is displayed in the text portion of the control, always comes from column one! Its value, on the other hand, can be taken from any column of its internal list. This means you can display meaningful text, such as the description from a lookup table, at the same time the control gets its value from the associated key. You do not even have to display this associated key in the list to have access to it.

The setting of BoundTo specifies whether the value property of a combo or list box is determined by its List or its ListIndex property. The setting of BoundTo only matters when the control is bound to a numeric data source. If the ControlSource of the combo or list box refers to numeric data, setting the control's BoundTo property to true tells Visual FoxPro to update the ControlSource using the data from the bound column of the control's internal list. Leaving BoundTo set to false here causes the ControlSource to be updated with the control's ListIndex, that is, the row number of the currently selected item.

The easiest way to illustrate how this works is by using a little code that simulates how the setting of the BoundTo property affects the way in which the control’s Value property is updated:
WITH This
  IF .BoundTo
    .Value = VAL( .List[.ListIndex, .BoundColumn] )
  ELSE
    .Value = .ListIndex
  ENDIF
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform