|
-
Sep 8th, 2007, 11:53 AM
#1
Thread Starter
PowerPoster
[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.
Last edited by Hack; Sep 10th, 2007 at 06:21 AM.
Reason: Added RESOLVED to thread title and green resolved checkmark
-
Sep 8th, 2007, 12:34 PM
#2
Frenzied Member
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.
-
Sep 8th, 2007, 06:52 PM
#3
Thread Starter
PowerPoster
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
-
Sep 9th, 2007, 12:07 AM
#4
Frenzied Member
Re: List View to ListBox thingy
ya, its simple
Code:
Private Sub List1_Click()
List1.RemoveItem List1.ListIndex
End Sub
-
Sep 9th, 2007, 11:26 AM
#5
Thread Starter
PowerPoster
Re: List View to ListBox thingy
Thank you for all your help bud cheers!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|