[dba-VB] VB.Net Wait for file to Download before launching

David McAfee davidmcafee at gmail.com
Wed Jan 20 16:28:20 CST 2010


Does anyone know how to do this?

I have this program that checks for updates :

            If IsUpdateAvailable() Then
                DownloadUpdate()
                LaunchUpdateInstaller()
                LaunchApp()
            Else
                LaunchApp()
            End If

The Update detection and Download work great:

    Private Sub DownloadUpdate()
        If Directory.Exists(InstallFilesPath) Then 'if the local path
exists then check for the actual file
            If File.Exists(InstallFilesPath + InstallFile) Then 'Check
to see if the new file is already installed
                'Delete file
                File.Delete(InstallFilesPath + InstallFile)
                'Then download it
                DownloadFile(NetPath + InstallFile, InstallFilesPath +
InstallFile)
            Else ' If the source file can't be found, Download new copy
                DownloadFile(NetPath + InstallFile, InstallFilesPath +
InstallFile)
            End If
        Else 'Directory did not exist, so create it and copy new file over
            Directory.CreateDirectory(InstallFilesPath)
            DownloadFile(NetPath + InstallFile, InstallFilesPath + InstallFile)
        End If
    End Sub

    Private Sub LaunchApp()
        'This sub launches the actual Program
        System.Diagnostics.Process.Start(AppPath + AppName)
    End Sub


The trouble is that it wants to run the LaunchApp() sub immediatley
after calling the LaunchUpdateInstaller() sub.
I was thinking of putting in a timer of some sort, but I was wondering
if there is some quicker/better way of doing this.

MTIA,
David McAfee



More information about the dba-VB mailing list