Freigeben über


XmlMappedRange.SelectionChange Event

Definition

Occurs when the selection inside the XmlMappedRange control changes.

public:
 event Microsoft::Office::Interop::Excel::DocEvents_SelectionChangeEventHandler ^ SelectionChange;
event Microsoft.Office.Interop.Excel.DocEvents_SelectionChangeEventHandler SelectionChange;
member this.SelectionChange : Microsoft.Office.Interop.Excel.DocEvents_SelectionChangeEventHandler 
Event SelectionChange As DocEvents_SelectionChangeEventHandler 

Event Type

Examples

The following code demonstrates a handler for the SelectionChange event that displays the address of the XmlMappedRange that was selected. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

 private void XmlMappedRange_SelectionChange()
{
    this.CustomerLastNameCell.SelectionChange += 
        new Excel.DocEvents_SelectionChangeEventHandler(
        CustomerLastNameCell_SelectionChange);
}

void CustomerLastNameCell_SelectionChange(Excel.Range Target)
{
    string selectedRange = Target.get_Address(Excel.XlReferenceStyle.xlA1);

    MessageBox.Show(this.Name + ":" + selectedRange + " raised the " +
        "SelectionChange event.");
}
Sub CustomerLastNameCell_SelectionChange(ByVal Target As Excel.Range) _
    Handles CustomerLastNameCell.SelectionChange
    Dim selectedRange As String = Target.Address( _
        ReferenceStyle:=Excel.XlReferenceStyle.xlA1)
    MsgBox(Me.Name & ":" & selectedRange & " raised the SelectionChange event.")
End Sub

Remarks

This event is raised when the selection changes to or within the XmlMappedRange control.

Applies to