Click here to Skip to main content
15,920,053 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all, I am a newbee and trying to write my first script. I successfully populated list of files from Folders in list boxes, but I want to move selected files from one folder to another using listbox selection. Please help me. Thanks
This script only adds to list, but not really moves inside folders.
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        i = ListBox1.SelectedItems.Count - 1
        Do While i >= 0

            ListBox2.Items.Add(ListBox1.SelectedItems.Item(i))

            ListBox1.Items.Remove(ListBox1.SelectedItems.Item(i))

            i = i - 1

        Loop
    End Sub

<pre lang="vb">
Posted

1 solution

You can use File.Move to move files.
http://msdn.microsoft.com/en-us/library/system.io.file.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900