CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Aug 2010
    Posts
    7

    Thumbs up Changes in a listbox

    Hello buddies

    I have a listbox whose items are added at runtime, How can I detect any new changes in the list of items ? (ie item label has been edited, new items are added etc esp after I have save all items information into a text file)


    Thank you

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Changes in a listbox

    Wouldn't it be your code that's doing the changing?

  3. #3
    Join Date
    Aug 2010
    Posts
    7

    Re: Changes in a listbox

    Quote Originally Posted by GCDEF View Post
    Wouldn't it be your code that's doing the changing?
    If you don't have a ****ing right answer to make then don't

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Changes in a listbox

    Quote Originally Posted by SaltedTamago View Post
    If you don't have a ****ing right answer to make then don't
    It was actually a reasonable question, and that kind of attitude doesn't work here.

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Changes in a listbox

    Quote Originally Posted by SaltedTamago View Post
    If you don't have a ****ing right answer to make then don't
    This type of response isn't going to be tolerated here - keep it up and you'll find you have a short stay on this forum.

    At any rate, GCDEF's question is reasonable. His point is that since you are in charge of add items to the list, presumably you would know when the items have been changed.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Changes in a listbox

    Quote Originally Posted by SaltedTamago View Post
    I have a listbox whose items are added at runtime, How can I detect any new changes in the list of items ? (ie item label has been edited, new items are added etc esp after I have save all items information into a text file)
    1. You cannot "edit" item label in the listbox. You can, however, delete an item and insert/add another one.
    2. You cannot add new items into listbox without using (direct or indirect) LB_INSERTSTRING or LB_ADDSTRING message in the code.

    So I have to agree with GCDEF and Arjay
    Victor Nijegorodov

  7. #7
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Changes in a listbox

    Quote Originally Posted by SaltedTamago View Post
    If you don't have a ****ing right answer to make then don't
    In my opinion that kind of attitude doesn't work anywhere.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  8. #8
    Join Date
    Aug 2010
    Posts
    7

    Re: Changes in a listbox

    I am surprised you understood his point, if that WAS the point then it should have been stated in his very first post, but then the explanation doesn't actually work anyway. Please limit your account numbers with pushy and poppy chats


    BTW, editing my own code to tell the world I am PROFESSIONAL seems always flawed

  9. #9
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Changes in a listbox

    Quote Originally Posted by SaltedTamago View Post
    I am surprised you understood his point,
    I understood GCDEF's point quite well. So you tell us, what did you think he meant?

    His point was quite clear. The only way a listbox changes is if your program changes it. Since it is your program changing it, then you know exactly when the listbox changed.
    Code:
    void ChangeListBox()
    {
        AddOrRemoveItemsFromMyListBox();
        DoStuffBecauseListBoxChanged();
    }
    That, on a high-level is what would be expected to solve your problem and exactly what GCDEF was referring to.

    Regards,

    Paul McKenzie

  10. #10
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Changes in a listbox

    Quote Originally Posted by SaltedTamago View Post
    I am surprised you understood his point, if that WAS the point then it should have been stated in his very first post, but then the explanation doesn't actually work anyway.
    Generally speaking you get more elaborate responses if you provide more context. Your first post provided no context whatsoever. Hence, the only sensible response is something along the lines of what GCDEF posted. If you don't get the kind of help you expected, then you probably made that impossible by leaving out some vital information, because I think you can see that people here are more than willing to help you (even after your ill-mannered post).
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  11. #11
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Changes in a listbox

    Quote Originally Posted by Paul McKenzie View Post
    I understood GCDEF's point quite well. So you tell us, what did you think he meant?

    His point was quite clear. The only way a listbox changes is if your program changes it. Since it is your program changing it, then you know exactly when the listbox changed.
    Code:
    void ChangeListBox()
    {
        AddOrRemoveItemsFromMyListBox();
        DoStuffBecauseListBoxChanged();
    }
    That, on a high-level is what would be expected to solve your problem and exactly what GCDEF was referring to.

    Regards,

    Paul McKenzie
    Thanks. Seemed clear enough considering the muddle that was the OP. I'm not sure what the relationship is between saving data in a text file and editing labels in a list box, whatever that means. Until the OP asks a question that makes sense, detailed answers aren't possible.

  12. #12
    Join Date
    Aug 2010
    Posts
    7

    Re: Changes in a listbox

    I have only dealt with a simple dialog with a listbox, where on earth other stuff appear and become related is really really bullshits. Ok through introduction to my program ? then for what ? if those are not parts of the related supply chain, then they wont definitely, EXCEPT changes to code to get my program compiled.
    I don't even need to work with this program to get it compiled anymore, persistent request means begging. There are still bunches of stuff, from small to big I need to consider.
    What a regret I have spent time and money on this!
    I forget my midnight and breakfast food. Never known of this. Thanks D_Drmmr for your reminds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured