Public Sub PasteFile()
For Each Me.lItem In leftListView.Items
If lItem.Selected = True Then
If File.Exists(lItem.Text) Then
lItem.ToString()
fSource = leftCBselect.Text & lItem.Text
Me.fTarget = rightCBselect.Text & lItem.Text
FileCopy(fSource, Me.fTarget)
rightListView.Items.Add(lItem.Clone)
'MsgBox("You have copied " & lItem.Text & " succesfully!", MsgBoxStyle.Information, "Information")
ElseIf Directory.Exists(lItem.Text) Then
fSource = leftCBselect.Text & lItem.Text
Me.fTarget = rightCBselect.Text & lItem.Text
My.Computer.FileSystem.CopyDirectory(fSource, Me.fTarget)
rightListView.Items.Add(lItem.Clone)
End If
End If
Next
End Sub
hello.
i have 2 listviews in which folder and files are loaded.
i'm trying to make a function that, when "Copy" button is pressed copies files/ folders between listviews (between folders "ex: from "D:\path" to "E:\path\subpath"). the codes of file copy and folder copy both work but not if add the file.exists / folder.exists lines. if i put a msgbox instead of the filecopy/ foldercopy it displays "file exists" or "folder exist" etc. .. but if add the file copy / folder copy line doens't do nothing.
this also happend when trying to do a dragndrop
Private Sub rightListView_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles leftListView.DragDrop, rightListView.DragDrop
Dim fSource, fTarget As String
For Each Me.lItem In leftListView.Items
If lItem.Selected = True Then
fSource = leftCBselect.Text & lItem.Selected
fTarget = rightCBselect.Text
FileCopy(fSource, fTarget)
rightListView.Items.Add(lItem.Clone())
End If
Next
End Sub
any ideas?