Download EXE File Using Visual Basic RRS feed

  • Question


    I am trying to download exe file from my server using Visal basic. Unfortunatly iam not able to download exe file. But at the same time i can able to download apart from EXE files.


    In below i have given my Code:


    Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

    Private Sub cmdMethod2_Click()

      Dim retVal As Long
        Dim theUrl As String
        Dim savePath As String
        Dim pathExist As Long
        theUrl = "
        If theUrl = "" Then Exit Sub
        savePath = App.Path & "\noodle.exe"
        If savePath = "" Then Exit Sub
        retVal = URLDownloadToFile(0, theUrl, savePath, 0, 0)


        If retVal = 0 Then
            MsgBox "File was downloaded successfully!", vbExclamation, " Download Successful"
            MsgBox "There was a error downloading the file. Make sure that the url is valid and try again!", vbCritical, " Error"
        End If

    End Sub

    if any one find a solution to solve the isseues please.

    Sunday, April 29, 2007 3:11 PM


  • It's not really an Orcas related question, but couldn't you just use the My.Computer.Network.DownloadFile option as in:
    my.Computer.Network.DownloadFile(theUrl, savePath


    Sunday, April 29, 2007 3:18 PM