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!

DataGridCell Structure

Identifies a cell in the grid.

Object
   ValueType
      DataGridCell

[Visual Basic]
Public Structure DataGridCell
[C#]
public struct DataGridCell
[C++]
public __value struct DataGridCell

[JScript] In JScript, you can use the structures in the NGWS frameworks, but you cannot define your own.

Remarks

The DataGridCell can be used in conjunction with the DataGrid control's CurrentCell property to get or set the value of any cell. Set the DataGrid control's CurrentCell property to a DataGridCell causes the focus to move to the cell specified by the DataGridCell.

The ColumnNumber and RowNumber properties can be passed to DataColumn and DataRow objects to specify a single data point in a data table.

Requirements

Namespace: System.WinForms

Assembly: System.WinForms.dll

Example [Visual Basic]

The following example assigns the DataGridCell to the CurrentCell of a DataGrid and returns the column and row number of the selected cell. The value stored in the DataTable is also printed using the DataGridCell object's RowNumber and ColumnNumber.

[Visual Basic]

Private Sub PrintCellRowAndCol()
   Dim myCell As DataGridCell
   myCell = DataGrid1.CurrentCell
   Debug.Print myCell.RowNumber
   Debug.Print myCell.ColumnNumber
   ' Print the value of the cell through the DataTable.
   Dim t As DataTable
   t = DataGrid1.CurrentGridTable.DataTable
   Console.WriteLine(t.Rows(myCell.RowNumber)(myCell.ColumnNumber))
End Sub

See Also

DataGridCell Members | System.WinForms Namespace | CurrentCell | DataColumn | DataGrid | DataRow | ColumnNumber | RowNumber