Skip to content
Home > Programming > How to write listbox items into text file ?

How to write listbox items into text file ?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #187473
    method
    Member

    Hi all . Could any one show me how i can write the listbox items in to text file ? So far i all know to how to loop the listbox items. I want to the button re write all the listbox each time i press it.Looking forward for reply.Thanks

    Private Sub Command8_Click()
    Dim i As Long

    For i = 0 To List1.ListCount - 1
    'If List1.Selected(I) = True Then
    'MsgBox List1.Text
    MsgBox List1.List(i)
    'End If
    Next
    End Sub
    #187476
    String
    Member

    You can use this function to add all list items to a txtbox. Each item will be seperated by a comma [ , ]

    Function Lst2Str(List As listbox)
    Dim X As Integer
    Dim Z As String

    For X = 0 To List.ListCount - 1
    Z = Z & "," & List.List(X)
    Next
    Lst2Str= Z

    End Function

    In your command button use:

    Text1 = Lst2Str(List1)

    Replace “Text1” and “List1” with what ever you need.
    That help you any?

    #187475
    Chike
    Member

    Here some gerber for ya.

    #187474
    AhFox
    Member

    Here is an application that suitable your needs:

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.