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
  1. Home
  2. General Programming
  3. C#
  4. Adding items at bottom in List View

Adding items at bottom in List View

Scheduled Pinned Locked Moved C#
algorithmstutorialquestion
5 Posts 4 Posters 0 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.
  • B Offline
    B Offline
    BalajiRamasamy
    wrote on last edited by
    #1

    Hi, In the list view i've couple of temporary items and they are staying at the bottom of the list, when i do sorting i dont want to include those two rows how to do that? Thanks

    OriginalGriffO B O 3 Replies Last reply
    0
    • B BalajiRamasamy

      Hi, In the list view i've couple of temporary items and they are staying at the bottom of the list, when i do sorting i dont want to include those two rows how to do that? Thanks

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Only way I know is to remove them, sort the list and then add them again, unless you inherit from the list view and provide your own custom enumeration.

      No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • B BalajiRamasamy

        Hi, In the list view i've couple of temporary items and they are staying at the bottom of the list, when i do sorting i dont want to include those two rows how to do that? Thanks

        B Offline
        B Offline
        Baeltazor
        wrote on last edited by
        #3

        BalajiRamasamy wrote:

        Adding items at bottom in List View

        Hi there, Try this, maybe you could like use it on a Button click event or something...: int i = listView1.Items.Count; listView1.Items.Add("NEW-ITEM", i++); -------- First, we define an Integer (i) and assign it the value of the total amount of items in the listView1 control, then we add an item at the bottom of the list by incrementing the total item amount by 1. Hope this helps regards, jase

        B 1 Reply Last reply
        0
        • B Baeltazor

          BalajiRamasamy wrote:

          Adding items at bottom in List View

          Hi there, Try this, maybe you could like use it on a Button click event or something...: int i = listView1.Items.Count; listView1.Items.Add("NEW-ITEM", i++); -------- First, we define an Integer (i) and assign it the value of the total amount of items in the listView1 control, then we add an item at the bottom of the list by incrementing the total item amount by 1. Hope this helps regards, jase

          B Offline
          B Offline
          BalajiRamasamy
          wrote on last edited by
          #4

          I did exactly the same, but after sorting what ever i add it automatically gets sorted and placed at the top, it is not listening me

          1 Reply Last reply
          0
          • B BalajiRamasamy

            Hi, In the list view i've couple of temporary items and they are staying at the bottom of the list, when i do sorting i dont want to include those two rows how to do that? Thanks

            O Offline
            O Offline
            OkkiePepernoot
            wrote on last edited by
            #5

            Something like this: this.listView1.Clear(); this.listView1.Items.Add("Item 2"); this.listView1.Items.Add("Item 1"); this.listView1.Sorting = SortOrder.Ascending; this.listView1.Sort(); this.listView1.Sorting = SortOrder.None; this.listView1.Items.Add("Temp1"); this.listView1.Items.Add("Temp2");

            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