ControlSource Property

Specifies the source of data to which an object is bound. Available at design time and run time.

Object.ControlSource[ = cName]


For controls, cName is a variable or field.

Applies To: CheckBox Control | Column Object | ComboBox Control | CommandGroup Control | EditBox Control | ListBox Control | OLE Bound Control | OptionButton Control | OptionGroup Control | Spinner Control | TextBox Control (Visual FoxPro)

Once the ControlSource property is set to a field or variable, the Value property always has the same data value and the same data type as the variable or field to which the ControlSource property is set.

For TextBox controls, cName is typically a field.

In a Grid control, if you do not specify a ControlSource setting for a column, the column displays the next available undisplayed field of the grid's record source.

If a Column's Bound property is set to True (.T.), the Column's ControlSource property setting applies to the column and any controls contained in it. If you attempt to set the contained control's ControlSource property, an error occurs. If a Column's Bound property is set to False (.F.), you can set the ControlSource property of a contained control directly. If you subsequently set the ControlSource setting of the Column, it overrides the ControlSource setting of the contained control.

Community Additions