Share via


XmlMappedRange.SelectionChange Event

Occurs when the selection inside the XmlMappedRange control changes.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
Event SelectionChange As DocEvents_SelectionChangeEventHandler
event DocEvents_SelectionChangeEventHandler SelectionChange

Remarks

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

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.

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
 private void XmlMappedRange_SelectionChange()
{
    this.CustomerLastNameCell.SelectionChange += 
        new Excel.DocEvents_SelectionChangeEventHandler(
        CustomerLastNameCell_SelectionChange);
}

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

    MessageBox.Show(this.Name + ":" + selectedRange + " raised the " +
        "SelectionChange event.");
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace