Export (0) Print
Expand All

Binding.DataSource Property

Gets the data source for this binding.

[Visual Basic]
Public ReadOnly Property DataSource As Object
[C#]
public object DataSource {get;}
[C++]
public: __property Object* get_DataSource();
[JScript]
public function get DataSource() : Object;

Property Value

An Object that represents the data source.

Remarks

Possible data sources include:

Example

The following example uses the DataSource property to return a DataSet.

[Visual Basic] 
Private Sub GetDataSource
    Dim ds As DataSet = CType(text1.DataBindings(0).DataSource, DataSet)
    Console.WriteLine(ds.Tables(0).TableName)
End Sub
End Class

[C#] 
private void GetDataSource()
{
   DataSet ds = (DataSet) text1.DataBindings[0].DataSource;
   Console.WriteLine(ds.Tables[0].TableName); 
}


[C++] 
private:
void GetDataSource() {
   DataSet* ds = dynamic_cast<DataSet*> (text1->DataBindings->Item[0]->DataSource);
   Console::WriteLine(ds->Tables->Item[0]->TableName);
}


[JScript] 
private function GetDataSource()
{
   var ds : DataSet = DataSet(text1.DataBindings[0].DataSource);
   Console.WriteLine(ds.Tables[0].TableName); 
}

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Binding Class | Binding Members | System.Windows.Forms Namespace

Show:
© 2014 Microsoft