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. List view question

List view question

Scheduled Pinned Locked Moved C#
questionjsontutorial
5 Posts 3 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.
  • A Offline
    A Offline
    al3xutzu00
    wrote on last edited by
    #1

    Hi guys, I have a list view that i want to to clear so that i can import data from a serialized file in it. i use the listview1.Clear() command that clears also the column headers, and the de-serialization doesn't work without the column headers. I have tried before the Clear() method this code : System.Windows.Forms.ListView.ColumnHeaderCollection coloane = listView1.Columns; foreach (ColumnHeader header in coloane) { listView1.Columns.Add(header.Text); } listView1.Clear(); and still it doesn't work. Any suggestions on how to clear a ListView without the colum headers ? Regards, Alex

    “Be the change you want to see in the world.”

    L D 2 Replies Last reply
    0
    • A al3xutzu00

      Hi guys, I have a list view that i want to to clear so that i can import data from a serialized file in it. i use the listview1.Clear() command that clears also the column headers, and the de-serialization doesn't work without the column headers. I have tried before the Clear() method this code : System.Windows.Forms.ListView.ColumnHeaderCollection coloane = listView1.Columns; foreach (ColumnHeader header in coloane) { listView1.Columns.Add(header.Text); } listView1.Clear(); and still it doesn't work. Any suggestions on how to clear a ListView without the colum headers ? Regards, Alex

      “Be the change you want to see in the world.”

      L Offline
      L Offline
      Luc 648011
      wrote on last edited by
      #2

      try ListView.Items.Clear() to clear the content, not the view itself. :)

      D 1 Reply Last reply
      0
      • A al3xutzu00

        Hi guys, I have a list view that i want to to clear so that i can import data from a serialized file in it. i use the listview1.Clear() command that clears also the column headers, and the de-serialization doesn't work without the column headers. I have tried before the Clear() method this code : System.Windows.Forms.ListView.ColumnHeaderCollection coloane = listView1.Columns; foreach (ColumnHeader header in coloane) { listView1.Columns.Add(header.Text); } listView1.Clear(); and still it doesn't work. Any suggestions on how to clear a ListView without the colum headers ? Regards, Alex

        “Be the change you want to see in the world.”

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #3

        try listView1.Items.Clear();

        Dave
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
        Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
        Why are you using VB6? Do you hate yourself? (Christian Graus)

        A 1 Reply Last reply
        0
        • L Luc 648011

          try ListView.Items.Clear() to clear the content, not the view itself. :)

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          beat me to it :laugh:

          Dave
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
          Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
          Why are you using VB6? Do you hate yourself? (Christian Graus)

          1 Reply Last reply
          0
          • D DaveyM69

            try listView1.Items.Clear();

            Dave
            BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
            Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
            Why are you using VB6? Do you hate yourself? (Christian Graus)

            A Offline
            A Offline
            al3xutzu00
            wrote on last edited by
            #5

            10x a lot :) it works fine:):D I should of thought of that :D Regards, Alex

            “Be the change you want to see in the world.”

            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