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. ListBox events

ListBox events

Scheduled Pinned Locked Moved C#
csharpquestion
6 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.
  • D Offline
    D Offline
    Deian
    wrote on last edited by
    #1

    Hello, I was playing around with the listbox control in visual c# express edition and I become frustrated when I couldnt find events such as OnInsert / AfterInsert and so on. Has Microsoft reduced events?

    J 1 Reply Last reply
    0
    • D Deian

      Hello, I was playing around with the listbox control in visual c# express edition and I become frustrated when I couldnt find events such as OnInsert / AfterInsert and so on. Has Microsoft reduced events?

      J Offline
      J Offline
      Jacky Yiu
      wrote on last edited by
      #2

      There has no OnInsert or AfterInsert, but listbox has ControlAdded and ControlRemoved, see if it's help.

      D 1 Reply Last reply
      0
      • J Jacky Yiu

        There has no OnInsert or AfterInsert, but listbox has ControlAdded and ControlRemoved, see if it's help.

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

        I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?

        J 1 Reply Last reply
        0
        • D Deian

          I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?

          J Offline
          J Offline
          Justin Perez
          wrote on last edited by
          #4

          Deian wrote:

          I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?

          I had encountered the same problem before. I couldn't find any such event that was usable. What I ended up doing, while it was extremely generic, was take a collection of all the items in the listbox, and compare the collection and the list, and when the count is different, you can "fire your event." It is pretty simple to find the item that has been added or removed. Like I said, it is pretty generic and crappy. But, it got the job done. Worked just fine for me.

          "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

          D 1 Reply Last reply
          0
          • J Justin Perez

            Deian wrote:

            I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?

            I had encountered the same problem before. I couldn't find any such event that was usable. What I ended up doing, while it was extremely generic, was take a collection of all the items in the listbox, and compare the collection and the list, and when the count is different, you can "fire your event." It is pretty simple to find the item that has been added or removed. Like I said, it is pretty generic and crappy. But, it got the job done. Worked just fine for me.

            "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

            D Offline
            D Offline
            Deian
            wrote on last edited by
            #5

            Thanks for the replies. There are several ways to get out of the situation, but I tought that I am missing something when reading the documentation. Regards, Deian

            J 1 Reply Last reply
            0
            • D Deian

              Thanks for the replies. There are several ways to get out of the situation, but I tought that I am missing something when reading the documentation. Regards, Deian

              J Offline
              J Offline
              Justin Perez
              wrote on last edited by
              #6

              Deian wrote:

              I tought that I am missing something when reading the documentation.

              Oh, unfortunately, and strangely enough, you are not.

              "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

              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