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

mckenziesandymckenziesandy Member Posts: 2
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 Member Posts: 3,948
    : 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.
  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    _________ { http://forcoder.org } free video tutorials and ebooks about || Ruby Java Perl Visual Basic .NET Swift MATLAB Python Assembly JavaScript C# PHP Delphi Visual Basic Scratch C Objective-C Go R C++ PL/SQL Lua Ada ML Prolog Awk Hack Lisp Scala COBOL Erlang Transact-SQL Dart Kotlin D ABAP VBScript Clojure Fortran Scheme FoxPro Logo SAS Bash Apex Rust LabVIEW F# Alice Crystal Julia || ____

Sign In or Register to comment.