I'm using the following in MS Excel VBA to get a file from a FTP server:
Dim lReturn As Long
Dim strFullURL As String
Dim strLocation As String
strFullURL = "ftp:\\myUserName:myPassword@192.168.100.114\
strLocation = "c:\DB\" & strFileName
lReturn = URLDownloadToFile(0, strFullURL, strLocation, 0, 0)
If lReturn <> 0 Then Call MsgBox("failed")
This works fine in MS Excel VBA, but when I try to use the same in VB.Net (Visual Basic 2010) I get the following error:
AccessViolationException was unhandled
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Need to get file(s) from the server using VB.Net. Can anyone provide a solution?