Groups | Blog | Home
all groups > vb.net upgrade > february 2004 >

vb.net upgrade : VB60 to .net Kill Function fails


Mike Austin
2/19/2004 9:56:05 AM
Hello everyone

I just migrated a project to VB.NET from 6.0. Made many code changes as required and it works fine except in one place now

I am trying to download a file from the FTP server and work with it. The first time it donwloads it works fine but the second time when it comes back the kill function fails. This is the code where it fails

If Dir(AppPath & "xxxxx.jpg") <> "" Then Kill(AppPath & "xxxxxx.jpg"

This worked fine in VB6.0 but fails with an assertion in .NET

Any help will be appreciated

THank you very much for your time

Mike
2/19/2004 11:16:08 AM
Hi Thank you for the suggestion. I did try to change it to File.Exists it compiled well. But when I tried to run it I got the same error

An unhandled exception of type 'System.IO.IOException' occurred in microsoft.visualbasic.dl
Additional information: The process cannot access the file "C:\XXXXXXX\XXX.jpg" because it is being used by another process

As you know I have searched for all FileOpen functions in my proj and added OpenShared.Shared parameter to it. Since that might cause the file to remain open. But my app doesnt even go to FileOpen. This is just in case when the File does not exist in the FTP server. I am downloading a file using FTPGetFile() each and every time and placing it in the app folder saving it as JPG and then try to kill it...

HELP

hirf-spam-me-here NO[at]SPAM gmx.at
2/19/2004 7:10:13 PM
* "=?Utf-8?B?TWlrZSBBdXN0aW4=?=" <anonymous@discussions.microsoft.com> scripsit:
[quoted text, click to view]

/Never/ use 'Dir' for checking if a file exists. Use 'File.Exists'
instead.

--
Herfried K. Wagner [MVP]
hirf-spam-me-here NO[at]SPAM gmx.at
2/19/2004 10:02:42 PM
* "=?Utf-8?B?TWlrZQ==?=" <anonymous@discussions.microsoft.com> scripsit:
[quoted text, click to view]

Does deleting work if you remove the code used to check if the file
exists?

--
Herfried K. Wagner [MVP]
AddThis Social Bookmark Button