|
-
Apr 11th, 2000, 03:39 PM
#1
Thread Starter
Frenzied Member
Is there a listView property which returns the number of checked items in a listview list?
I was going to do it like this but I wondereed if there was already a property.
(I'm sur I can't find it if there is!)
Code:
Dim SelectedCount As Integer
Dim i as Integer
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Checked Then
SelectedCount = SelectedCount + 1
End If
Next i
-
Apr 11th, 2000, 04:09 PM
#2
Fanatic Member
There is indeed a property and it is called "SelCount"
List1.SelCount
Iain, thats with an i by the way!
-
Apr 11th, 2000, 04:17 PM
#3
Thread Starter
Frenzied Member
Is there a listView property which returns the number of checked items in a listview list?
-
Apr 11th, 2000, 04:26 PM
#4
Fanatic Member
Terribly sorry old chap, crossed wires and all. Thought you were talking about list box.
Iain, thats with an i by the way!
-
Apr 11th, 2000, 07:22 PM
#5
Hyperactive Member
I don't think there is....
Previously I've just looped through my ListItems checking the ListItem.Selected boolean and counting them that way...
Not too big a pain in the arse unless your list is huge..

Dan
Ok - for Selected read Checked not that it matters much...
[Edited by Judd on 04-12-2000 at 08:25 AM]
-
Jul 19th, 2000, 03:41 PM
#6
This is so late! But I found it .
Code:
'Author: Ascher Stefan
'Author's email: http://stefan.scriptmania.com
'Date Submitted: 11/26/1999
'Compatibility: VB 6
'Task: SelCount for ListViews. I have not found a property which returns
the count of the selected Items in a ListView (VB5), but it is no problem
to make it on your own via API.
'Declarations
Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA"
_
(ByVal hwnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const LVM_FIRST = &H1000
Private Const LVM_GETSELECTEDCOUNT = (LVM_FIRST + 50)
'Code:
Public Function GetSelCount(lvhwnd As Long) As Integer
GetSelCount = SendMessageAny(lvhwnd, LVM_GETSELECTEDCOUNT, 0&, 0&)
End Function
-
Jul 20th, 2000, 02:13 AM
#7
Thread Starter
Frenzied Member
Good grief Matt!
what made you did this one up?
I couldn't even remember posting the original question!
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
|