Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
SelectedItem Property (ActiveX Controls)
Returns a reference to a selected ListItem, Node, or Tab object.
Syntax
object.SelectedItem
The object placeholder represents an object expression that evaluates to an object in the Applies To list.
Remarks
The SelectedItem property returns a reference to an object that can be used to set properties and invoke methods on the selected object. This property is typically used to return a reference to a ListItem,Node, or Tab or object that the user has clicked or selected. With this reference, you can validate an object before allowing any further action, as demonstrated in the following code:
Command1_Click()
' If the selected object is not the root, then remove the Node.
If TreeView1.SelectedItem.Index <> 1 Then
Treeview1.Nodes.Remove TreeView1.SelectedItem.Index
End If
End Sub
To programmatically select a ListItem object, use the Set statement with the SelectedItem property, as follows:
Set ListView1.SelectedItem = ListView1.ListItems(1)