[RESOLVED] List View to ListBox thingy
Hey guys I have a listview called lvwfound and I was wondering, how do I click on a item that added to the list view to a list box thing.
The code that adds thigns to the list view is
VB Code:
Dim i As Integer
Dim item As String
Dim iResponce As Integer
i = Me.lvwFound.ListItems.Count 'list count
For i = 0 To i - 1
'MsgBox Me.lvwFound.ListItems(i + 1)
item = Me.lvwFound.ListItems(i + 1)
'
Would i replace lvwfound with list4 ? Also i there a click event for a listview so only when I click on items in a listview it will add that item to a listbox?
Thank you.
Re: List View to ListBox thingy
Well, couldnt understand the question clerarly, but found two ways to add the selected items to the list box (List1). Check it out
Code:
Private Sub ListView1_Click()
Dim i As Integer
Dim lstItem As ListItem
List1.Clear
List1.Refresh
For Each lstItem In ListView1.ListItems
If lstItem.Selected = True Then
List1.AddItem ListView1.ListItems(lstItem.Index)
End If
Next
End Sub
or
Code:
Private Sub ListView1_Click()
List1.AddItem ListView1.SelectedItem
End Sub
hope this is what you are looking for.
:wave:
Re: List View to ListBox thingy
thank you that works great. One more question would be, can an item be removed? Like if there was a item on the list1 listbox and i clicked on it in the listbox would it go away?
thanks
Re: List View to ListBox thingy
ya, its simple
Code:
Private Sub List1_Click()
List1.RemoveItem List1.ListIndex
End Sub
:wave:
Re: List View to ListBox thingy
Thank you for all your help bud cheers!!!!