Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how to save ListBox in vb.net

xxn5xxn5 Posts: 5Member

how to save ListBox in vb.net Dim files() As String files = Directory.GetFiles("C:\", "*.mp3")

Dim file As String For Each file In files ListBox1.Items.Add(Path.GetFileName(file)) Next

output : 00001.mp3 00003.mp3 00005.mp3 ....

want to save all item wth Only filenam to another folder.

Comments

  • CzareqPLCzareqPL PolandPosts: 2Member

    'You can do it like this:

     Dim YourFiles As New ArrayList
    
        Dim k As Integer
        For k = 0 To ListBox1.Items.Count - 1
            YourFiles.Add(ListBox1.Items(k).ToString)
    
        Next k
        'Now you can access it like this:
    
        For k = 0 To YourFiles.Count - 1
            ListBox2.Items.Add(YourFiles.Item(k).ToString)
        Next
    

    'I prefer to use ArrayList instad of simple arrays because they are more flexible and you can inherit one arraylist inside another...

Sign In or Register to comment.