Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/06/2012, 10:10
alexg88
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años
Puntos: 344
Respuesta: Copiar múltiples archivos a directorio VB.Net 2005

Buenas,

El problema es que el método File.Copy esperá recibir la ruta de un archivo origen y la ruta de un archivo destino (no de un directorio).

La solución es la siguiente:

Código vb:
Ver original
  1. If Directory.Exists(RutaDestinoRecibo) Then
  2.                 Dim DlgAbrir As New OpenFileDialog()
  3.                 DlgAbrir.Multiselect = True
  4.  
  5.                 If (DlgAbrir.ShowDialog() = Windows.Forms.DialogResult.OK) Then
  6.                         For Each rutaorigen In DlgAbrir.FileNames
  7.                          System.IO.File.Copy(rutaorigen, System.IO.Path.Combine( RutaDestinoRecibo,System.IO.Path.GetFileName(rutaorigen)), True)
  8.                     Next
  9.                 End If
  10. End If