|
-
Sep 4th, 2002, 06:24 AM
#1
Thread Starter
Hyperactive Member
Listview and index
Dear Friends,
I have a listview control. When i click on a record (full fow select) i need to know the index of the record i have selected.
With the same listview i have checkbox, when i click on command_1 (for exaple) i need to know the indexes of the checked records.
how can i resolv that problem?
Best regards,
-
Sep 4th, 2002, 07:48 AM
#2
PowerPoster
Getting index is simple:
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim intIndex As Integer
intIndex = Item.Index
End Sub
But what do you mean by saying "With the same listview i have checkbox" ?
Roy
-
Sep 4th, 2002, 08:37 AM
#3
New Member
VB Code:
Private Sub Command1_Click()
Dim li As ListItem
Dim checkedCol As Collection
Set checkedCol = New Collection
'Where lvw is your listview.
For Each li In lvw.ListItems
If li.Checked = True Then
'add its key to a collection
checkedCol.Add li.Index
Debug.Print li.Index
End If
Next
'CheckedCol now contains a list of the
'indexes of all the items that were checked.
End Sub
Try this.
-
Sep 4th, 2002, 08:47 AM
#4
PowerPoster
smokingjoe,
I'd rather wait untill he responds then give him a sample loop.
-
Sep 4th, 2002, 09:08 AM
#5
New Member
still waiting!
-
Sep 4th, 2002, 09:14 AM
#6
PowerPoster
-
Sep 4th, 2002, 07:44 PM
#7
Thread Starter
Hyperactive Member
Hey many thanks for the reply . I am verry happy now . I could not respond because i wasn't home.
thanks
-
Sep 4th, 2002, 07:46 PM
#8
Thread Starter
Hyperactive Member
-
Sep 5th, 2002, 07:24 AM
#9
PowerPoster
Resolve what? Diddn't you get what you were looking for? It looks to me that smokinjoe gave a very nice example on how to follow mouse pointer. If you still have a problem with that issue then reply, if not then mark that tread as Resolved.
Roy
-
Sep 6th, 2002, 08:02 AM
#10
Thread Starter
Hyperactive Member
IROY55 yes smokinjoe have give me a very nice piece of code but when i hade post this...
Maybee you can resolv this to?
http://www.vbforums.com/showthread....threadid=196412
...smokinjoe was still writing the code for me so i had not any code. Now i have and this post is closed.
Thanks,
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
|