Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. WinForms ListView

WinForms ListView

Scheduled Pinned Locked Moved .NET (Core and Framework)
c++csharpwinformsquestion
9 Posts 5 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • realJSOPR Online
    realJSOPR Online
    realJSOP
    wrote on last edited by
    #1

    Is it possible to use callbacks (like in the old days with C++/MFC) to display listview items? Or how about an observable collection that tells a listview that its data has changed? Anything like that?

    .45 ACP - because shooting twice is just silly
    -----
    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
    -----
    "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

    D P R 3 Replies Last reply
    0
    • realJSOPR realJSOP

      Is it possible to use callbacks (like in the old days with C++/MFC) to display listview items? Or how about an observable collection that tells a listview that its data has changed? Anything like that?

      .45 ACP - because shooting twice is just silly
      -----
      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

      D Offline
      D Offline
      darkyro
      wrote on last edited by
      #2

      in vb.net to get the items in listview take this

      dim name as string
      dim ind as integer

      for each items as listviewitem in listview1.items
      ' here you get the name of the item
      name = items.text ' or items
      'here your get the index
      ind = items.index

      next items

      A 1 Reply Last reply
      0
      • D darkyro

        in vb.net to get the items in listview take this

        dim name as string
        dim ind as integer

        for each items as listviewitem in listview1.items
        ' here you get the name of the item
        name = items.text ' or items
        'here your get the index
        ind = items.index

        next items

        A Offline
        A Offline
        Abhinav S
        wrote on last edited by
        #3

        Using INotifyProprtyChanged with an obseravable collection is a good option. Have a look here - http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c86df936-853f-452f-ad98-7d2ac53958ff[^]. Hope this helps.

        realJSOPR 1 Reply Last reply
        0
        • realJSOPR realJSOP

          Is it possible to use callbacks (like in the old days with C++/MFC) to display listview items? Or how about an observable collection that tells a listview that its data has changed? Anything like that?

          .45 ACP - because shooting twice is just silly
          -----
          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          One way to achieve this would be to have your collection implement INotifyCollectionChanged (if using ObservableCollection is out of bounds), and use a mediator class to monitor the changes. Obviously you'd want to use INotifyPropertyChanged for individual items in the collection.

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys | Onyx

          realJSOPR 1 Reply Last reply
          0
          • P Pete OHanlon

            One way to achieve this would be to have your collection implement INotifyCollectionChanged (if using ObservableCollection is out of bounds), and use a mediator class to monitor the changes. Obviously you'd want to use INotifyPropertyChanged for individual items in the collection.

            "WPF has many lovers. It's a veritable porn star!" - Josh Smith

            As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

            My blog | My articles | MoXAML PowerToys | Onyx

            realJSOPR Online
            realJSOPR Online
            realJSOP
            wrote on last edited by
            #5

            Would using a DataGridView be a better option? I don't want anything fancy - I just need the listview to update items that have changed (possibly hundreds of items changing every 2 or three seconds or so). BTW, this isn't a WPF application...

            .45 ACP - because shooting twice is just silly
            -----
            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

            P 1 Reply Last reply
            0
            • A Abhinav S

              Using INotifyProprtyChanged with an obseravable collection is a good option. Have a look here - http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c86df936-853f-452f-ad98-7d2ac53958ff[^]. Hope this helps.

              realJSOPR Online
              realJSOPR Online
              realJSOP
              wrote on last edited by
              #6

              This is not a WPF application.

              .45 ACP - because shooting twice is just silly
              -----
              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
              -----
              "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

              A 1 Reply Last reply
              0
              • realJSOPR realJSOP

                Is it possible to use callbacks (like in the old days with C++/MFC) to display listview items? Or how about an observable collection that tells a listview that its data has changed? Anything like that?

                .45 ACP - because shooting twice is just silly
                -----
                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

                R Offline
                R Offline
                Rama Krishna Vavilala
                wrote on last edited by
                #7

                You can use the VirtualMode in list view. http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.virtualmode.aspx[^] This way you can specify your own content in call back events.

                Click here to get a Google Wave Invite.

                1 Reply Last reply
                0
                • realJSOPR realJSOP

                  This is not a WPF application.

                  .45 ACP - because shooting twice is just silly
                  -----
                  "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                  -----
                  "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

                  A Offline
                  A Offline
                  Abhinav S
                  wrote on last edited by
                  #8

                  Will these links help you? Both use INotify. http://blog.spencen.com/2009/03/04/inotifypropertychanged-via-extension-methods.aspx[^] http://stackoverflow.com/questions/638859/c-winforms-how-to-update-listbox-items-with-inotifypropertychanged[^]

                  1 Reply Last reply
                  0
                  • realJSOPR realJSOP

                    Would using a DataGridView be a better option? I don't want anything fancy - I just need the listview to update items that have changed (possibly hundreds of items changing every 2 or three seconds or so). BTW, this isn't a WPF application...

                    .45 ACP - because shooting twice is just silly
                    -----
                    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                    -----
                    "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    I don't know that DGV would be a better choice. The fact that the listview supports virtualisation is a big plus. BTW - I figured it wasn't WPF.

                    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                    My blog | My articles | MoXAML PowerToys | Onyx

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups