简体   繁体   中英

Downloading a file into Application path

so i am using this code to download file

Dim exePath As String = Application.ExecutablePath()
My.Computer.Network.DownloadFile(TextBox2.Text, exePath & "/img.png")

where textbox2 contains url to .png file but i get this error在此处输入图片说明

Note that test.exe is on Desktop.

You can do it in this way

My.Computer.Network.DownloadFile(TextBox2.Text, Environment.CurrentDirectory & "/img.png");

Environment.CurrentDirectory Will give you the current working directory.

I hope this will work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM