no selection in my listview

christie
03-27-2003, 06:14 AM
hi,

i've made a listview, and i want to make sure nothing is selected when the form starts up, so my fill looks like this:

With lvShowList
.View = lvwReport
.GridLines = True
.LabelWrap = True
.FullRowSelect = True

.ColumnHeaders.Add , , "Naam"

'then here i _do_ stuff , is all ok, just fill the thing up with
'the correct data

With .ListItems
For i = 0 To UBound(arrData)
.Add , , arrData(i)
Next i
End With
Set lvShowList.SelectedItem = Nothing
End With

when i debug: selected item is set to nothing,
unfortunately, it _is_ set to the first item.
anybody's got a clue on how to _really_ set selecteditem to nothing (and make it stay that way untill a user clicked on something)

thanx,
christie

Machaira
03-27-2003, 06:51 AM
Is there another control on the form? If not then it looks like you're out of luck as if the control has focus (and it will if there's no other control on the form that can receive focus - labels don't count) something has to be selected.

christie
03-27-2003, 07:02 AM
Is there another control on the form? If not then it looks like you're out of luck as if the control has focus (and it will if there's no other control on the form that can receive focus - labels don't count) something has to be selected.

i've got a textbox next to the listview where people can insert a 'search' text, but the really weird thing is, that i use similar code in other places, and _that_ works just fine. worse: i ripped this code from those places!
i just don't get it..... when i put a watch on 'selecteditem', it says it's 'nothing'

Machaira
03-27-2003, 10:45 AM
Does the ListView have a TabIndex of 0? If so, set the textbox's TabIndex to 0.

Just saw something - try ListView1.SelectedItem.Selected = False. I don't work with the ListView much so it wasn't obvious. :)

christie
03-28-2003, 05:51 AM
Does the ListView have a TabIndex of 0? If so, set the textbox's TabIndex to 0.

Just saw something - try ListView1.SelectedItem.Selected = False. I don't work with the ListView much so it wasn't obvious. :)

listview1.selecteditem.selected=false, doesn't work(when i do that without setting the tabindex, it generates an error, when the tabindex of the textbox is set to 0 it's suddenly allowed?), but i set the tabindex of the textbox to 0, and that works! thanx

greetz,
christie.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum