Identifies a cell in the grid.
[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.
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.
Namespace: System.WinForms
Assembly: System.WinForms.dll
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
DataGridCell Members | System.WinForms Namespace | CurrentCell | DataColumn | DataGrid | DataRow | ColumnNumber | RowNumber