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.Item

Gets or sets the value of a cell.

[C#] In C#, this member is the indexer for the DataGrid class.

Overload List

Gets or sets the value of the cell at the specified the row and column.

[Visual Basic] Overloads Public Default Property Item(Integer, Integer) As Object
[C#] public object this[int, int] {get; set;}
[C++] public: __property Object* get_Item(int, int);
public: __property void set_Item(int, int, Object*);
[JScript] DataGrid.Item (int, int)

Gets or sets the value of a specified DataGridCell.

[Visual Basic] Overloads Public Default Property Item(DataGridCell) As Object
[C#] public object this[DataGridCell] {get; set;}
[C++] public: __property Object* get_Item(DataGridCell);
public: __property void set_Item(DataGridCell, Object*);
[JScript] DataGrid.Item (DataGridCell)

Example [Visual Basic]

The following example sets and gets the value of a cell by declaring a DataGridCell variable, setting its RowNumber and ColumnNumber values, then first changing, then returning, the value of the given cell.

Note   This example shows how to use one of the overloaded versions of the Item property (DataGrid indexer). For other examples that may be available, see the individual overload topics.

[Visual Basic]

Private Sub SetCellValue()
   Dim myCell As DataGridCell
   ' Use an arbitrary cell.
   myCell.RowNumber = 0
   myCell.ColumnNumber = 0
   ' Change the cell's value using the CurrentCell
   DataGrid1(myCell)= "New Value"
End Sub

Private Sub GetCellValue()
   Dim myCell = DataGridCell
   ' Use an arbitrary cell.
   myCell.RowNumber = 0
   myCell.ColumnNumber = 0
   Console.WriteLine(DataGrid1(myCell))
End Sub

See Also

DataGrid Class | DataGrid Members | System.WinForms Namespace