By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,642 Members | 2,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,642 IT Pros & Developers. It's quick & easy.

Problem about listview

P: 4
I'm having a problem now.
How to count item that I selected in listview (multiselect). So I select more than 1.

I hope the solving for my problem.

Thank's
Nov 29 '07 #1
Share this Question
Share on Google+
12 Replies


hariharanmca
100+
P: 1,977
Use check boxe in listview. That will be easy to count.
Nov 29 '07 #2

Mohan Krishna
100+
P: 115
I'm having a problem now.
How to count item that I selected in listview (multiselect). So I select more than 1.

I hope the solving for my problem.

Thank's
Hi
May this be helpful to you...
Expand|Select|Wrap|Line Numbers
  1. Private Sub List1_Click()
  2.     Label1.Caption = List1.SelCount
  3. End Sub
  4.  
ALL THE BEST!
respond is it helpful...
Nov 29 '07 #3

lotus18
100+
P: 866
Hi
May this be helpful to you...
Expand|Select|Wrap|Line Numbers
  1. Private Sub List1_Click()
  2.     Label1.Caption = List1.SelCount
  3. End Sub
  4.  
ALL THE BEST!
respond is it helpful...
Hi Mohan Krishna

faiz03l is referring to a listview and not on listbox : )

Rey Sean
Nov 30 '07 #4

Mohan Krishna
100+
P: 115
Hi Mohan Krishna

faiz03l is referring to a listview and not on listbox : )

Rey Sean
Hi Lotus

I am sorry!

May this help...
Expand|Select|Wrap|Line Numbers
  1.     Dim iCheked, iSelected As Integer
  2.     For Each itm In Me.ListView1.ListItems
  3.         With itm
  4.             If .Checked Then                'checked?
  5.                 iChecked = iChecked + 1
  6.             End If
  7.             If .Selected Then
  8.                 iSelected = iSelected + 1   'selected?
  9.             End If
  10.         End With
  11.     Next
  12.     MsgBox "Checked = " & iCheked & vbLf & "Selected = " & iSelected
  13.  
ThanQ
Nov 30 '07 #5

lotus18
100+
P: 866
Hi Lotus

I am sorry!

May this help...
Expand|Select|Wrap|Line Numbers
  1.     Dim iCheked, iSelected As Integer
  2.     For Each itm In Me.ListView1.ListItems
  3.         With itm
  4.             If .Checked Then                'checked?
  5.                 iChecked = iChecked + 1
  6.             End If
  7.             If .Selected Then
  8.                 iSelected = iSelected + 1   'selected?
  9.             End If
  10.         End With
  11.     Next
  12.     MsgBox "Checked = " & iCheked & vbLf & "Selected = " & iSelected
  13.  
ThanQ
Hi Mohan

Have you tried getting the number of selected items without using a checkbox from the listview?

Rey Sean
Nov 30 '07 #6

Mohan Krishna
100+
P: 115
Hi Mohan

Have you tried getting the number of selected items without using a checkbox from the listview?

Rey Sean
Yeah!

I got no. of selected items but not the checked items.
Nov 30 '07 #7

hariharanmca
100+
P: 1,977
There I told use check box in list view, and it's easy to see the checked items.
Nov 30 '07 #8

lotus18
100+
P: 866
Yeah!

I got no. of selected items but not the checked items.
Hello Mohan

Sorry I didn't notice that it also counts the no. of selected items. I think I'm going to wear a reading glass : )

Good job Mohan.

Rey Sean
Nov 30 '07 #9

P: 4
There I told use check box in list view, and it's easy to see the checked items.

Sorry, I'm a beginer.
Can you tell me how to add check box in list view?

And for all thank you for your help...
Dec 3 '07 #10

lotus18
100+
P: 866
Sorry, I'm a beginer.
Can you tell me how to add check box in list view?

And for all thank you for your help...
Hi faiz03l

From your listview, right-click then select Properties > General tab > Checkboxes

Rey Sean
Dec 3 '07 #11

hariharanmca
100+
P: 1,977
From your listview, right-click then select Properties > General tab > Checkboxes and check that Checkboxes checkbox.
Dec 3 '07 #12

P: 4
Thank you...

I has 1 question again, how to delete teks line by line?
Dec 4 '07 #13

Post your reply

Sign in to post your reply or Sign up for a free account.