0

For my application I am trying to create a directory for my program, download an executable into the folder and then run it but I am getting two errors,

Error 1 Too many arguments to 'Public Shared Function Exists(path As String) As Boolean'.

Error 2 Value of type 'String' cannot be converted to 'System.Security.AccessControl.DirectorySecurity'.

any Idea what I am doing wrong?

 Imports System.DirectoryServices
 Imports System.IO

Module Download
    Public Sub DownloadExecute(ByVal url As String)
        Dim folder As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
        If (Not System.IO.Directory.Exists(folder, "TankGame\Installer")) Then
            System.IO.Directory.CreateDirectory(folder, "TankGame\Installer")
        End If
        Dim Downloadedfile = Path.Combine(folder, "TankGame\Installer\installer.exe")
        My.Computer.Network.DownloadFile("url", Downloadedfile)
        Process.Start(Downloadedfile)
    End Sub
End Module
Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
  • `System.IO.Directory.Exists(path As String) As Boolean` there is no second argument as the message indicates. Where does the other error occur (what line)? – Ňɏssa Pøngjǣrdenlarp Sep 27 '14 at 12:25
  • 1
    You might try reading the documentation for these methods you're calling or even just paying attention to Intellisense. If you want to build a path from more than one part then you have to do that first and then pass the single result to methods like `Directory.Exists`. You can't pass it multiple partial paths and assume that it will realise you expect it to join them together. – jmcilhinney Sep 27 '14 at 13:25

0 Answers0