Share via


XmlMappedRange.Deselected Event (2007 System)

Occurs when selection moves from the XmlMappedRange control to an area outside of the XmlMappedRange control.

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

Syntax

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

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

Remarks

This event is raised only when the XmlMappedRange control has focus, and then focus is transferred away from the XmlMappedRange control.

Examples

The following code demonstrates a handler for the Deselected event that displays the address of the new selected range when an XmlMappedRange is deselected. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

Sub CustomerLastNameCell_Deselected(ByVal Target As Excel.Range) _
    Handles CustomerLastNameCell.Deselected
    Dim deselectedRange As String = Target.Address( _
        ReferenceStyle:=Excel.XlReferenceStyle.xlA1)
    MsgBox("CustomerLastNameCell was deselected. " & _
        "The new selection is " & deselectedRange)
End Sub
private void XmlMappedRange_Deselected()
{
    this.CustomerLastNameCell.Deselected += 
        new Excel.DocEvents_SelectionChangeEventHandler(
        CustomerLastNameCell_Deselected);
}

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

    MessageBox.Show("CustomerLastNameCell was deselected. The new " +
        "selection is " + deselectedRange);
}

.NET Framework Security

See Also

Reference

XmlMappedRange Class

XmlMappedRange Members

Microsoft.Office.Tools.Excel Namespace