1.11M Members

Help Listview

 
0
 

im currently working on listview and i think i need help :)
all i need to do is when i click the button it select the items and so on up to the last item
and set back to beginning

bu im my code its just up to the first entry of the list

the texbox2 and 3 is working file it gets the text of selected items in list view

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        If ListView1.Items.Count > 1 Then
            ListView1.Items(0).Selected = True
            ListView1.Select()
        End If

        TextBox2.Text = ListView1.Items.Item(ListView1.FocusedItem.Index).SubItems(0).Text
        TextBox3.Text = ListView1.Items.Item(ListView1.FocusedItem.Index).SubItems(1).Text
    end sub
 
0
 

There is a lot of missing context, and honestly I didn't take that long to understand your question... however...

ListView1.Items(0).Selected = True
Items(0) is the first item, so it sounds like that's your problem.

 
0
 

can you show me how ?

if i click the button the selected first index jumps to second item of the list and so on of to the last index
thats my problem now and i dont know ho to do it in listview

but in listbox is easier
listbox1.selectedindex + =1

 
0
 

Something like,

ListView1.Items.Item(ListView1.FocusedItem.Index+1).Selected = True;
ListView1.Items.Item(ListView1.FocusedItem.Index).Selected = False;

Though I'm not certain of your objective.

 
0
 

i think your code is just desame with my code in If statement

my code abode does this but when i click the buton i doesnt move to the second index to select another item

Image Sample

Uniportant thanks for the reply thanks bro

 
1
 

No, I meant for you to replace item(0) with item(selected) and set it to false, then set item(selected+1) to true. It's not the same.

Question Answered as of 1 Year Ago by Unimportant
 
0
 

thank Unimportant :)

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article