Spread Windows Forms 6.0 Product Documentation
SelectionChanged Event
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : SelectionChanged Event


Glossary Item Box

Occurs when the selection of cells on the sheet is changed.

Syntax

Visual Basic (Declaration) 
Public Event SelectionChanged As SelectionChangedEventHandler
Visual Basic (Usage)Copy Code
Dim instance As FpSpread
Dim handler As SelectionChangedEventHandler
 
AddHandler instance.SelectionChanged, handler
C# 
public event SelectionChangedEventHandler SelectionChanged

Event Data

The event handler receives an argument of type SelectionChangedEventArgs containing data related to this event. The following SelectionChangedEventArgs properties provide information specific to this event.

PropertyDescription
Range Gets the range of cells encompassing the selection.
View Gets the view that contain the selection.

Remarks

This event is raised by the OnSelectionChanged method when the sheet selection is changed.

This event occurs each time the selected range of cells changes when the user extends the selection by dragging the mouse or by pressing simultaneously the Shift key and an arrow key.

For more details on the individual event arguments, refer to SelectionChangedEventArgs members.

Example

This example raises the event.
C#Copy Code
private void fpSpread1_SelectionChanged(object sender, FarPoint.Win.Spread.SelectionChangedEventArgs e)
{
     FarPoint.Win.Spread.Model.CellRange cr;
     cr = e.View.Sheets[0].GetSelection(0);
     Label1.Text = "The first column in the selection is " + cr.Column + " and the first row is " + cr.Row;
}
Visual BasicCopy Code
Private Sub FpSpread1_SelectionChanged(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.SelectionChangedEventArgs) Handles
FpSpread1.SelectionChanged
     Dim cr As FarPoint.Win.Spread.Model.CellRange
     cr = e.View.Sheets(0).GetSelection(0)
     Label1.Text = "The first column in the selection is " & cr.Column & " and the first row is " & cr.Row
End Sub

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.