怎么把listbox1中的信息输出到一个文件中保存并且程序重新启动的时候再从文件加载到listbox1?
最好使得输出的内容用以文本方式打开的察看是看到的不是原来的内容。

解决方案 »

  1.   

    你就程序用程序 写文本文件,名字起的有规律一点(Mylist_00001什么的),程序启动就读这文件,没什么啊!
      你可以把一项listbox写成一行,读的时候读一行,就加载一行
      

  2.   

    我要输出到一个文件,用append和lineinput好像。具体怎么写不太会。
      

  3.   

    Private Sub Form_Load()
    Dim i As Integer, s1 As String
    If Dir(App.Path & "\1.txt") <> "" Then
    Open App.Path & "\1.txt" For Input As #1
        For i = 0 To List1.ListCount - 1
         Line Input #1, s1
         List1.AddItem s1
        Next i
    Close #1
    End If
    End Sub
    Private Sub Form_Click()
    Dim i As Integer
    Open App.Path & "\1.txt" For Output As #1
        For i = 0 To List1.ListCount - 1
         Print #1, List1.List(i)
        Next i
    Close #1End Sub