Results 1 to 2 of 2

Thread: i need help bad!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    20

    Post

    how do i make it. where some one add a item in a list box and close the prog. and next time there open it that item there. but i need it will over 1 item about 1 to 1000.

    thanks.

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    The only way I can think about is to save info from ListBox to a file. Here is how to do it (this will involve a CommandButton - cmdAdd, TextBox and ListBox)
    Code:
    Private Sub cmdAdd_Click()
        Dim I As Integer
        List1.AddItem Text1.Text
        Open "C:\Windows\Desktop\Test.txt" For Output As #1
        For I = 0 To List1.ListCount - 1
            Print #1, List1.List(I)
        Next I
        Close #1
    End Sub
    
    Private Sub Form_Load()
        Dim I As Integer
        Dim stLine As String
        Open "C:\Windows\Desktop\Test.txt" For Input As #1
        Do While Not EOF(1)
            Line Input #1, stLine
            List1.AddItem stLine
        Loop
        Close #1
    End Sub
    Hope this will help

    ------------------
    Visual Basic Programmer (at least I want to be one)
    ------------------
    PolComSoft
    You will hear a lot about it.


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