Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

I'm still having trouble with list boxes

I can't seem to save information stored in a list box correctly. When I save on exit of the program the previous file is overwritten (which I expect) but the first item in the list box is always overwritten by the first storing only one name in the list box. I have checked all my varibles and they seem to be fine and i can save data correctly from text boxes and labels ok. I just can't figure it out. A piece of sample code would help me out a lot. Thanks

Comments

  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : I can't seem to save information stored in a list box correctly. When I save on exit of the program the previous file is overwritten (which I expect) but the first item in the list box is always overwritten by the first storing only one name in the list box. I have checked all my varibles and they seem to be fine and i can save data correctly from text boxes and labels ok. I just can't figure it out. A piece of sample code would help me out a lot. Thanks
    :
    [code]
    Open "filename" For Output As 1
    For I = 0 To ListName.ListCount - 1
    Print #1, ListName.List(I)
    Next
    Close
    [/code]
    [code]
    Open "filename" For Input As 1
    Do Until EOF(1)
    Line Input #1, T
    List1.AddItem T
    Loop
    Close
    [/code]
    Not sure what you meant by "...first item in the list box is always overwritten by the first storing only one name in the list box...", but that code should help you out.
Sign In or Register to comment.