Código:
Function Descargar_Archivo(ByVal Url As String, _ ByVal Path_Destino As String, ByVal overwrite As Boolean) As Boolean If Url = vbNullString Or Path_Destino = vbNullString Then MsgBox("No se indicó la url o el archivo de destino", _ MsgBoxStyle.Critical, "Error") Else If Len(Dir(Path_Destino)) <> 0 Then 'MsgBox("el archivo destino ya existe.Elija otro destino diferente", _ 'MsgBoxStyle.Exclamation, "Error") 'Else On Error Resume Next My.Computer.Network.DownloadFile(Url, Path_Destino) If Err.Number >= 0 Then Descargar_Archivo = True Else MsgBox(Err.Description) End If Err.Clear() End If End If End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ret As Boolean ret = Descargar_Archivo(txt_url.Text, txt_path_destino.Text, overwrite:= True) If ret Then MsgBox("Archivo descargado correctamente", MsgBoxStyle.Information) End If End Sub
ya trate de poner el overwrite en la sentencia siguiente agregandoselo pr ejemplo:
My.Computer.Network.DownloadFile(Url, Path_Destino, overwrite:=true)
pero marca un error sobre que dice que es una sobre carga el caso es que no se como hacer para reemplazar el archivo que intento descargar
alguien podria ayudarme muchas graciasss