Wednesday, 15 September 2010

vb.net - Error : file is being used by another process -



vb.net - Error : file is being used by another process -

i have problem says file beingness used process

but pretty sure it's not beingness used anywhere else..

imports system.io public class browse private sub add_click(sender object, e eventargs) handles add.click dim files new openfiledialog dim folder new folderbrowserdialog dim filelist string = "c:\program files\ftp-sync\files.txt" dim filep string = "" dim list() string = io.file.readalllines(filelist) if fileb.checked seek if system.io.file.exists(filelist) = true , files.showdialog = windows.forms.dialogresult.ok filep = files.filename end if grab ex exception msgbox(ex.message) end seek end if if folderb.checked seek if system.io.file.exists(filelist) = true , folder.showdialog = windows.forms.dialogresult.ok filep = folder.selectedpath end if grab ex exception msgbox(ex.message) end seek end if pathtxt.text = filep end sub private sub ok_click(sender object, e eventargs) handles ok.click dim filelist string = "c:\program files\ftp-sync\files.txt" dim author streamwriter = new streamwriter(filelist) dim filep string = "" seek if pathtxt.text = "" msgbox("no folder or file has been choosen") else author = file.appendtext(filelist) writer.writeline(pathtxt.text) pathtxt.text = filep writer.close() me.hide() end if grab ex exception msgbox(ex.message) end seek end sub private sub cancel_click(sender object, e eventargs) handles cancel.click me.hide() end sub private sub browse_load(sender object, e eventargs) handles mybase.load end sub end class

thanks in advance!

it because of this:

dim author streamwriter = new streamwriter(filelist)

i changed

dim author streamwriter

and work charm.. dont know if right way.. worked.

vb.net

No comments:

Post a Comment