XmlMappedRange.Selected Event (2007 System)

Occurs when the XmlMappedRange control is selected.

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

Syntax

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

AddHandler instance.Selected, handler
public event DocEvents_SelectionChangeEventHandler Selected
public:
 event DocEvents_SelectionChangeEventHandler^ Selected {
    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 the XmlMappedRange control.

Examples

The following code demonstrates a handler for the Selected 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_Selected(ByVal Target As Excel.Range) _
    Handles CustomerLastNameCell.Selected
    Dim selectedRange As String = Target.Address( _
        ReferenceStyle:=Excel.XlReferenceStyle.xlA1)
    MsgBox(Me.Name & ":" & selectedRange & " was selected.")
End Sub
private void XmlMappedRange_Selected()
{
    this.CustomerLastNameCell.Selected += 
        new Excel.DocEvents_SelectionChangeEventHandler(
        CustomerLastNameCell_Selected);
}

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

    MessageBox.Show(this.Name + ":" + selectedRange + " was selected.");
}

.NET Framework Security

See Also

Reference

XmlMappedRange Class

XmlMappedRange Members

Microsoft.Office.Tools.Excel Namespace