Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List View Box that Selects Automatically

Status
Not open for further replies.

cwalshe

Programmer
May 28, 2001
84
0
0
IE
HI there,

I have a list view box that selects the first item by default. How can I code, so that it will select nothing unless none so by the user.

Rgds,

Cormac.
 
Try this
Code:
List1.ListIndex = -1

Let me know if this helps
 
No afraid not, listindex isn't supported by listview.
 
on the click and double click event disallow anything except list1.list(0)

if list1.listindex = 0 then
' do your actions
end if
 
Ok, so its a listview box, not a list. I imagine that there is a difference because listindex is not supported by listview.

I would have thought that this would be rather easy to do. I am assuming that listview boxes, by default, selected the first item, so basically I'd like to deselect that item.
 
I'm no longer sure what u are trying to achieve?

is it Selection of only the first item IE lstview1.nodes(0)

or are u trying to deny use of any other nodes IE
lstview.selecteditem <> 0
 
OK, so I have a listview box that is being populated from an external source. If at Form Load I ask what the selected item is, it says its the first item in the list. It seems to select the first by default. I want the app to load up and not select anything, ie selecteditem is equal to nothing. Then if the user clicks on a item etc, that item then becomes selected.

Sorry if I'm not explaining myself well and thx for the time.
 
Sorry I misread your original post.

Try

Code:
Dim x As ListItem
For Each x In ListView1.ListItems
x.Selected = False
Next

It works for me!

Let me know if this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top