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. How to handle "New string added" event in ListBox?

How to handle "New string added" event in ListBox?

Scheduled Pinned Locked Moved C#
questiontutorial
3 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.
  • S Offline
    S Offline
    Sarvan AL
    wrote on last edited by
    #1

    Hi Everybody, I have a multi-column listbox. I need to change the width of the listbox, based on the string length. I've written the code in a function 'ResetLBWidth'. This function should get called whenever I add a string to the list box. How can I handle this? I don't find any event like "NewItemAdded".. Suggest me a path to achieve this. Thanks in advance, Sarvan AL

    M Q 2 Replies Last reply
    0
    • S Sarvan AL

      Hi Everybody, I have a multi-column listbox. I need to change the width of the listbox, based on the string length. I've written the code in a function 'ResetLBWidth'. This function should get called whenever I add a string to the list box. How can I handle this? I don't find any event like "NewItemAdded".. Suggest me a path to achieve this. Thanks in advance, Sarvan AL

      M Offline
      M Offline
      Mandaar Kulkarni
      wrote on last edited by
      #2

      There is no any event like "NewItemAdded" for listbox. If you are mannually filling the listbox then the whole control is in your hand. You can call the method ResetLBWidth where you are adding the data to listbox. If you have assigned some data source to the list box and your data source is changing then you have DataSourceChanged event to map.

      1 Reply Last reply
      0
      • S Sarvan AL

        Hi Everybody, I have a multi-column listbox. I need to change the width of the listbox, based on the string length. I've written the code in a function 'ResetLBWidth'. This function should get called whenever I add a string to the list box. How can I handle this? I don't find any event like "NewItemAdded".. Suggest me a path to achieve this. Thanks in advance, Sarvan AL

        Q Offline
        Q Offline
        quiteSmart
        wrote on last edited by
        #3

        There is an event called TextChanged that rises whenever the text changes in the textbox. Meaning it will rises if u delete a character, add a character, replace a charachter ....... good luck

        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