다음을 통해 공유


XmlMappedRange.Deselected Event

Definition

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

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

Event Type

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.

private void XmlMappedRange_Deselected()
{
    this.CustomerLastNameCell.Deselected += 
        new Excel.DocEvents_SelectionChangeEventHandler(
        CustomerLastNameCell_Deselected);
}

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

    MessageBox.Show("CustomerLastNameCell was deselected. The new " +
        "selection is " + deselectedRange);
}
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

Remarks

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

Applies to