Binding.DataSource 属性

定义

获取该绑定的数据源。Gets the data source for this binding.

public:
 property System::Object ^ DataSource { System::Object ^ get(); };
public object DataSource { get; }
member this.DataSource : obj
Public ReadOnly Property DataSource As Object

属性值

Object

一个表示数据源的 ObjectAn Object that represents the data source.

示例

下面的代码示例使用 DataSource 属性返回一个 DataSetThe following code example uses the DataSource property to return a DataSet.

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

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

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

注解

可能的数据源包括:Possible data sources include:

适用于