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. C#
  4. how to clear text from a listBox in C# VS2008 forms application

how to clear text from a listBox in C# VS2008 forms application

Scheduled Pinned Locked Moved C#
csharptutorial
4 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.
  • M Offline
    M Offline
    msheekhah
    wrote on last edited by
    #1

    I think I found the MSDN page to add text, but I need to clear it first.

    listBox1.Items.Add(((TextBox)sender).Text);

    F P 2 Replies Last reply
    0
    • M msheekhah

      I think I found the MSDN page to add text, but I need to clear it first.

      listBox1.Items.Add(((TextBox)sender).Text);

      F Offline
      F Offline
      fly904
      wrote on last edited by
      #2

      listBox1.Items.Clear(); ?

      My failometer is detecting vast quantities of FAIL! "Its SQL - hardly programming..." (Caslen)

      1 Reply Last reply
      0
      • M msheekhah

        I think I found the MSDN page to add text, but I need to clear it first.

        listBox1.Items.Add(((TextBox)sender).Text);

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

        Here's a hint. Try and break the problem down. If I were you, I'd be thinking along the lines "I know - I need to clear some items from this collection, so I have an Items collection. Now, what could the method be to clear things from Items?"

        "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

        J 1 Reply Last reply
        0
        • P Pete OHanlon

          Here's a hint. Try and break the problem down. If I were you, I'd be thinking along the lines "I know - I need to clear some items from this collection, so I have an Items collection. Now, what could the method be to clear things from Items?"

          "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

          J Offline
          J Offline
          jas0n23
          wrote on last edited by
          #4

          that was helpful, it helped me answer a completely different question that I had in my head. :-) thank you.

          foreach( inch on Jason ) { Girlfriend.IsHappier(); }

          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