Spread WPF Documentation
SetActiveCell(Int32,Int32,Boolean) Method
Example 


The row index of the cell.
The column index of the cell.
Whether to clear selections.
Sets the active cell on this sheet.
Syntax
'Declaration
 
Public Overloads Sub SetActiveCell( _
   ByVal row As System.Integer, _
   ByVal column As System.Integer, _
   ByVal clearSelection As System.Boolean _
) 
'Usage
 
Dim instance As Worksheet
Dim row As System.Integer
Dim column As System.Integer
Dim clearSelection As System.Boolean
 
instance.SetActiveCell(row, column, clearSelection)
public void SetActiveCell( 
   System.int row,
   System.int column,
   System.bool clearSelection
)

Parameters

row
The row index of the cell.
column
The column index of the cell.
clearSelection
Whether to clear selections.
Example
This example uses the SetActiveCell method.
gcSpreadSheet1.Sheets[0].SetActiveCell(5, 5);
//gcSpreadSheet1.Sheets[0].SetActiveCell(2, 2, true);
gcSpreadSheet1.Invalidate();

private void button1_Click(object sender, RoutedEventArgs e)
        {
        listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveCell().ToString());
        listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveColumn.ToString());
        listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveColumnIndex);
        listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveRow.ToString());
        listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveRowIndex);
        gcSpreadSheet1.Invalidate();
         }

private void gcSpreadSheet1_EnterCell(object sender, GrapeCity.Windows.SpreadSheet.UI.EnterCellEventArgs e)
        {
        listBox1.Items.Add(e.Column.ToString());
        listBox1.Items.Add(e.Row.ToString());
        }

private void gcSpreadSheet1_LeaveCell(object sender, GrapeCity.Windows.SpreadSheet.UI.LeaveCellEventArgs e)
    {
       listBox1.Items.Add(e.Column.ToString());
       listBox1.Items.Add(e.Row.ToString());
   }
GcSpreadSheet1.Sheets(0).SetActiveCell(5, 5)
'GcSpreadSheet1.Sheets(0).SetActiveCell(2, 2, True)
GcSpreadSheet1.Invalidate()

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveCell().ToString())
        ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveColumn.ToString())
        ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveColumnIndex)
        ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveRow.ToString())
        ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveRowIndex)
        GcSpreadSheet1.Invalidate()
    End Sub

Private Sub GcSpreadSheet1_EnterCell(sender As System.Object, e As GrapeCity.Windows.SpreadSheet.UI.EnterCellEventArgs) Handles GcSpreadSheet1.EnterCell
        ListBox1.Items.Add(e.Column.ToString())
        ListBox1.Items.Add(e.Row.ToString())
    End Sub

    Private Sub GcSpreadSheet1_LeaveCell(sender As System.Object, e As GrapeCity.Windows.SpreadSheet.UI.LeaveCellEventArgs) Handles GcSpreadSheet1.LeaveCell
        ListBox1.Items.Add(e.Column.ToString())
        ListBox1.Items.Add(e.Row.ToString())
    End Sub
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional (SP4), Windows XP (SP2), Windows 2008, Windows 2003 Server (SP1)

See Also

Reference

Worksheet Class
Worksheet Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.