event ObjectSelected (Object as ExShellObject)
Fired when a new object is selected.

 TypeDescription 
   Object as ExShellObject A reference to the ExShellObject being selected.  
The ObjectSelected event notifies your application that a new items in the list is selected. The StateChange event notifies your application whether the control loses or gains the focus, when the user renamed an item, or whether the user selects a new item.

In case your control supports single selection, you can use the ObjectSelected event to notify when a new item/object is selected:

Private Sub ExShellView1_ObjectSelected(ByVal Object As EXSHELLVIEWLibCtl.IExShellObject)
    If Not (Object Is Nothing) Then
        Debug.Print Object.Name
    End If
End Sub

The following sample gets a collection of selected items ( in case your control allows multiple selection ):

Private Sub ExShellView1_StateChange(ByVal newState As EXSHELLVIEWLibCtl.StatesEnum)
    If (newState = SelChangeState) Then
        ExShellView1.Objects.Get SelectedItems
        With ExShellView1.Objects
            For i = 0 To .Count - 1
                Debug.Print .Item(i).Name
            Next
        End With
    End If
End Sub

Send comments on this topic.
© 1999-2010 Exontrol.COM, Software. All rights reserved.