Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/05/2011, 13:08
proteus8
 
Fecha de Ingreso: junio-2008
Ubicación: Osorno
Mensajes: 155
Antigüedad: 16 años, 8 meses
Puntos: 3
Respuesta: Descargar Archivo mediante aplicación hecha en VB.net

Cita:
Iniciado por Peterpay Ver Mensaje
Entonces mejor usa la clase

WebClient

y su metodo DownloadFile o DownloadData
y como se usa esa clase
intente hacerlo como sale en la pagina de la microsoft pero me marca errores, y no se donde se pone la ruta de descarga, este es el código que puse:
Código vb:
Ver original
  1. Public Sub DownloadFile( _
  2. ByVal address As String, _
  3. ByVal fileName As String _
  4. )
  5.  
  6.     End Sub
  7.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8.         Dim remoteUri As String = "http://111.111.111.11:8090/archivos/"
  9.         Dim fileName As String = "archivo.rar"
  10.         Dim myStringWebResource As String = Nothing
  11.         ' Create a new WebClient instance.
  12.        Dim myWebClient As New WebClient()
  13.         ' Concatenate the domain with the Web resource filename. Because DownloadFile
  14.        'requires a fully qualified resource name, concatenate the domain with the Web resource file name.
  15.        myStringWebResource = remoteUri + fileName
  16.         Console.WriteLine("Downloading File ""{0}"" from ""{1}"" ......." + ControlChars.Cr + ControlChars.Cr, fileName, myStringWebResource)
  17.         ' The DownloadFile() method downloads the Web resource and saves it into the current file-system folder.
  18.        myWebClient.DownloadFile(myStringWebResource, fileName)
  19.         Console.WriteLine("Successfully Downloaded file ""{0}"" from ""{1}""", fileName, myStringWebResource)
  20.         Console.WriteLine((ControlChars.Cr + "Downloaded file saved in the following file system folder:" + ControlChars.Cr + ControlChars.Tab + Application.StartupPath))
  21. End Sub
me marca error en estas lineas:
Código vb:
Ver original
  1. Dim myWebClient As New WebClient() ' "El tipo WebClient no esta definido
  2.  
  3. Console.WriteLine((ControlChars.Cr + "Downloaded file saved in the following file system folder:" + ControlChars.Cr + ControlChars.Tab + Application.StartupPath))
  4.  
  5.  'en esta ultima me dice : ' " StartupPath no es un miembro de system.windows.form.application


me podrías dar una manito con esto por favor!!!