1,105,332 Community Members

Help Listview

Member Avatar
markjames2012
Newbie Poster
10 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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
Member Avatar
Unimportant
Posting Whiz in Training
267 posts since Oct 2010
Reputation Points: 18 [?]
Q&As Helped to Solve: 54 [?]
Skill Endorsements: 9 [?]
 
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.

Member Avatar
markjames2012
Newbie Poster
10 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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

Member Avatar
Unimportant
Posting Whiz in Training
267 posts since Oct 2010
Reputation Points: 18 [?]
Q&As Helped to Solve: 54 [?]
Skill Endorsements: 9 [?]
 
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.

Member Avatar
markjames2012
Newbie Poster
10 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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

Member Avatar
Unimportant
Posting Whiz in Training
267 posts since Oct 2010
Reputation Points: 18 [?]
Q&As Helped to Solve: 54 [?]
Skill Endorsements: 9 [?]
 
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 9 Months Ago by Unimportant
Member Avatar
markjames2012
Newbie Poster
10 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

thank Unimportant :)

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