XmlMappedRange.SelectionChange Event (2007 System)

Occurs when the selection inside the XMLMappedRange control changes.

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

Syntax

'Declaration
Public Event SelectionChange As DocEvents_SelectionChangeEventHandler
'Usage
Dim instance As XmlMappedRange 
Dim handler As DocEvents_SelectionChangeEventHandler 

AddHandler instance.SelectionChange, handler
public event DocEvents_SelectionChangeEventHandler SelectionChange
public:
 event DocEvents_SelectionChangeEventHandler^ SelectionChange {
    void add (DocEvents_SelectionChangeEventHandler^ value);
    void remove (DocEvents_SelectionChangeEventHandler^ value);
}
JScript does not support events.

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 Class

XmlMappedRange Members

Microsoft.Office.Tools.Excel Namespace