Stránka 1 z 1

File not Found, přitom existuje VB.NET

Napsal: 26 říj 2009 10:11
od CZechBoY
Zdravim,
mám program na stáhnutí souboru z netu a následné uložení a spuštění.
Program se hryzne u toho spuštění, soubor neexistuje, přitom přes funkci FileExist to ukazuje že existuje.

Kód: Vybrat vše

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cesta As String = InputBox("Vložte adresu souboru na internetu")
        If cesta <> Nothing Then
            Dim cestaOff As String = Application.StartupPath & "\" & IO.Path.GetFileName(cesta)
            If IO.File.Exists(cestaOff) = True Then IO.File.Delete(cestaOff)
            My.Computer.Network.DownloadFile(cesta, cestaOff)
            MsgBox("Soubor " & cestaOff & " existuje ? " & IO.File.Exists(cestaOff))
            Shell(cestaOff)
        End If
    End Sub
End Class