Problem about listview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • faiz03l
    New Member
    • Nov 2007
    • 4

    Problem about listview

    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
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Use check boxe in listview. That will be easy to count.

    Comment

    • Mohan Krishna
      New Member
      • Oct 2007
      • 115

      #3
      Originally posted by faiz03l
      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...
      Code:
      Private Sub List1_Click()
          Label1.Caption = List1.SelCount
      End Sub
      ALL THE BEST!
      respond is it helpful...

      Comment

      • lotus18
        Contributor
        • Nov 2007
        • 865

        #4
        Originally posted by Mohan Krishna
        Hi
        May this be helpful to you...
        Code:
        Private Sub List1_Click()
            Label1.Caption = List1.SelCount
        End Sub
        ALL THE BEST!
        respond is it helpful...
        Hi Mohan Krishna

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

        Rey Sean

        Comment

        • Mohan Krishna
          New Member
          • Oct 2007
          • 115

          #5
          Originally posted by lotus18
          Hi Mohan Krishna

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

          Rey Sean
          Hi Lotus

          I am sorry!

          May this help...
          Code:
              Dim iCheked, iSelected As Integer
              For Each itm In Me.ListView1.ListItems
                  With itm
                      If .Checked Then                'checked?
                          iChecked = iChecked + 1
                      End If
                      If .Selected Then
                          iSelected = iSelected + 1   'selected?
                      End If
                  End With
              Next
              MsgBox "Checked = " & iCheked & vbLf & "Selected = " & iSelected
          ThanQ

          Comment

          • lotus18
            Contributor
            • Nov 2007
            • 865

            #6
            Originally posted by Mohan Krishna
            Hi Lotus

            I am sorry!

            May this help...
            Code:
                Dim iCheked, iSelected As Integer
                For Each itm In Me.ListView1.ListItems
                    With itm
                        If .Checked Then                'checked?
                            iChecked = iChecked + 1
                        End If
                        If .Selected Then
                            iSelected = iSelected + 1   'selected?
                        End If
                    End With
                Next
                MsgBox "Checked = " & iCheked & vbLf & "Selected = " & iSelected
            ThanQ
            Hi Mohan

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

            Rey Sean

            Comment

            • Mohan Krishna
              New Member
              • Oct 2007
              • 115

              #7
              Originally posted by lotus18
              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.

              Comment

              • hariharanmca
                Top Contributor
                • Dec 2006
                • 1977

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

                Comment

                • lotus18
                  Contributor
                  • Nov 2007
                  • 865

                  #9
                  Originally posted by Mohan Krishna
                  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

                  Comment

                  • faiz03l
                    New Member
                    • Nov 2007
                    • 4

                    #10
                    Originally posted by hariharanmca
                    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...

                    Comment

                    • lotus18
                      Contributor
                      • Nov 2007
                      • 865

                      #11
                      Originally posted by faiz03l
                      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

                      Comment

                      • hariharanmca
                        Top Contributor
                        • Dec 2006
                        • 1977

                        #12
                        From your listview, right-click then select Properties > General tab > Checkboxes and check that Checkboxes checkbox.

                        Comment

                        • faiz03l
                          New Member
                          • Nov 2007
                          • 4

                          #13
                          Thank you...

                          I has 1 question again, how to delete teks line by line?

                          Comment

                          Working...