How do you reset the listview so that the last item clicked on is no longer highlighted?
Printable View
How do you reset the listview so that the last item clicked on is no longer highlighted?
VB Code:
Me.ListView1.Update()
Easy enough. Tnx!
oops... it doesn't work. Here's my code... after showing the messagebox, I want the highlighted item previously clicked to no longer be highlighted.
Code:Private Sub lvwCensus_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvwCensus.DoubleClick
Dim intIndex As Integer = lvwCensus.SelectedIndices.Item(0)
MessageBox.Show(intIndex)
Me.lvwCensus.Update()
End Sub
Ok , the only way I can think of right now is to send focus to another control . Something like this :
VB Code:
Private Sub lvwCensus_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvwCensus.DoubleClick Dim intIndex As Integer = lvwCensus.SelectedIndices.Item(0) MessageBox.Show(intIndex) Me.Button1.Focus() End Sub
I thought there might have been a better way, but that works fine. Thanks for the help.
found this... haven't test it
VB Code:
If lvw.SelectedItems.Count <> 0 Then lvw.Items.RemoveAt(lvw.SelectedItems(0).Index())
http://www.pscode.com/URLSEO/vb/scripts/ShowCode!asp/txtCodeId!1578/lngWid!10/anyname.htm
otherwise (haven't used listview), is there a selectedindex=-1 work?
lol , that will remove the listviewitem completely .;)Quote:
Originally posted by nemaroller
found this... haven't test it
VB Code:
If lvw.SelectedItems.Count <> 0 Then lvw.Items.RemoveAt(lvw.SelectedItems(0).Index())
http://www.pscode.com/URLSEO/vb/scripts/ShowCode!asp/txtCodeId!1578/lngWid!10/anyname.htm
otherwise (haven't used listview), is there a selectedindex=-1 work?
Good... then it won't be selected anymore. Case solved :)
Haha! I never knew that learning could be so fun...ny!Quote:
Good... then it won't be selected anymore.
Thanks for the link:wave: