I'm still having trouble with list boxes - Programmers Heaven

Howdy, Stranger!

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

Categories

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.