VB中list控件中的内容如何存为txt格式?我用的是组合框,选择后内容在list里面,但不知如何存为记事本或word!求助!

解决方案 »

  1.   

    dim I as long,Buff() as stringredim buff(list1.listcount-1)
    for i=0 to ubound(buff)
        buff(I)=list1.list(I)
    nextopen "d:\1.txt" for binary as #1
        put #1,,join(buff(),vbcrlf)
    close #1    
      

  2.   


    Private Sub Command1_Click()
        Dim i As Integer
        Open "c:\test.txt" For Output As #1
            For i = 0 To List1.ListCount - 1
                Print #1, List1.List(i)
            Next i
        Close #1
        Shell "notepad.exe c:\test.txt", vbNormalFocus
    End SubPrivate Sub Form_Load()
        For i = 0 To 99
            List1.AddItem i
        Next i
    End Sub