System.Windows.Forms.ListControl.DataSource Property

Gets or sets the data source for this System.Windows.Forms.ListControl.

Syntax

[System.ComponentModel.AttributeProvider(typeof(System.ComponentModel.IListSource))]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
[System.ComponentModel.DefaultValue(null)]
public object DataSource { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

There are two ways to fill the System.Windows.Forms.ComboBox and System.Windows.Forms.ListBox controls.

For example, you can add objects to the System.Windows.Forms.ComboBox by using the System.Windows.Forms.ComboBox.ObjectCollection.Add(object) method. You can also add objects to a System.Windows.Forms.ComboBox by using the ListControl.DataSource, ListControl.DisplayMember, and ListControl.ValueMember properties to fill the System.Windows.Forms.ComboBox.

When the ListControl.DataSource property is set, a user cannot modify the items collection.

If setting the ListControl.DataSource property causes the data source to change, the ListControl.DataSourceChanged event is raised. If setting this property causes the data member to change, the ListControl.DisplayMemberChanged event is raised.

When you set ListControl.DataSource to null, ListControl.DisplayMember is set to an empty string ("").

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0