NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataGrid.DataSource

Gets or sets the data source that the grid is displaying data for.

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

Property Value

A Object that functions as a data source.

Remarks

Valid sources include the following:

Example [Visual Basic]

The following example creates a DataView and assigns it to the DataSource property.

[Visual Basic]

Private Sub SetDS(ByRef myGrid As DataGrid)
   Dim myTable As DataTable
   ' Code to create columns and populate not shown.
   ' Create a DataView using the DataTable
   Dim dv As DataView
   dv = New DataView(myTable)
   myGrid.DataSource = dv
   ' Populate grid.
   DataGrid.Populate
End Sub

Private Sub GetDataTableFromDataSource()
   ' If the DataSource is bound to a DataTable, create a DataTable variable,
   ' and set it to the DataSource.
   Dim t As DataTable
   t = DataGrid1.DataSource
End Sub

Private Sub GetDataViewFromDataSource()
   ' Similarly, you can use a DataView object variable:
   Dim dv As DataView
   dv = DataGrid1.DataSource
End Sub

See Also

DataGrid Class | DataGrid Members | System.WinForms Namespace | DataSet | DataSetView | DataView