BoundTo
This property was one of the most welcome additions to VFP 5. It lets you indicate whether a numeric ControlSource for a combo or list contains the position of the selected item or the value of the item.
Usage |
lBindToNumericValue = oObject.BoundTo |
Changes to BoundTo are not compatible with setting Value in the Property Sheet. If BoundTo is set to anything but the default (that is, shows bold in the Property Sheet), any value saved to the Value property is lost (though Value shows as non-default). |
There's also a problem when BoundTo is set to .T. and the combo is bound to a numeric property of an ActiveX control (or at least some ActiveX controls). If we set BoundTo to .T. and set ControlSource to the ChartTitle.Orientation property of an MS Graph object in the Property Sheet, VFP bombs when we try to run the form. If we wait and assign the ControlSource in code, the form runs and the binding takes, but the current value of the combo doesn't display when the combo is closed. |
Example |
oForm = CREATEOBJECT("Form") * Add a list with character data in the first column * and numeric in the second, which is the bound column. OForm.AddObject("lstTwoCol","ListBox") WITH oForm.lstTwoCol .Visible = .T. .RowSourceType = 1 && Value .RowSource = "Fred,17,Ethel,31,Lucy,2,Ricky,49" .ColumnCount = 2 .ColumnWidths = "50,30" .BoundColumn = 2 .BoundTo = .T. && Treat column 2 as numbers. ENDWITH oForm.Show() |
See Also |