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);
The DataGridCell with the focus.
Setting the CurrentCell property will cause the grid to scroll and show the cell if it isn't already visible.
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
DataGrid Class | DataGrid Members | System.WinForms Namespace | DataGridCell | SelectionBackColor | SelectionForeColor | FirstVisibleColumn