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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listview selectedindexchanged

Status
Not open for further replies.

kalle82

Technical User
Apr 2, 2009
163
SE
Hi!

I have a listview. As you can see i update it on click.

Is there a way to update it when i use the up- and downarrows to change my selection in the list? It should change as the selected index changes.. Been looking but I can't seem to find a solution.. :(

Code:
Private Sub ListView1_Click()
page = Me.MultiPage1.Value

Val2 = ListView1.SelectedItem.Index

personnummer = ListView1.ListItems.Item(Val2).SubItems(1)

diarienummret = ListView1.SelectedItem

Label3.Caption = "Diarienummer: " + diarienummret
Label2.Caption = "Personnummer: " + personnummer

Call readlogfile2(personnummer, page)

End Sub


Thanks :)
 
You can use a KeyPress, KeyDown, or KeyUp event, then detect the key that is being pressed and increment, decrement your index accordingly.
 
Use ItemClick event, it fires when you chance selection with up/down arrows too.

combo
 
oops. I thought they were talking about VBA for MSOffice and the listbox, not VB6, so I don't know if my suggested events will work or not... Im not familiar with VB6's controls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top