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

Gets or sets which cell has the focus. Not available at design time.

[Visual Basic]
Public Property CurrentCell As DataGridCell
[C#]
public DataGridCell CurrentCell {get; set;}
[C++]
public: __property DataGridCell get_CurrentCell();
public: __property void set_CurrentCell(DataGridCell);
[JScript]
public function get CurrentCell() : DataGridCell;
public function set CurrentCell(DataGridCell);

Property Value

The DataGridCell with the focus.

Remarks

Setting the CurrentCell property will cause the grid to scroll and show the cell if it isn't already visible.

Example [Visual Basic]

The following examples show how to set and get the current cell.

[Visual Basic]

Private Sub SetCellWithFocus(ByVal myGrid As DataGrid)
   ' Set the current cell to cell 1, row 1.
   myGrid.CurrentCell = New DataGridCell(1,1)
End Sub

Private Sub DataGrid1_GotFocus(ByVal Sender As Object, ByVal e As EventArts)
   Console.WriteLine(DataGrid1.CurrentCell.ColumnNumber, DataGrid1.CurrentCell.RowNumber)
End Sub

See Also

DataGrid Class | DataGrid Members | System.WinForms Namespace | DataGridCell | SelectionBackColor | SelectionForeColor | FirstVisibleColumn