Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

VB Access to the path C:/Program.. is denied (vb.net), Unable to write into log file sometimes

views
     
Eventless
post Aug 20 2011, 09:16 PM

Look at all my stars!!
*******
Senior Member
2,643 posts

Joined: Jan 2003
So does this error occur when creating a new file, using the old file or both cases? It could be possible that you've already opened the file earlier and have not properly closed it.

If you are losing previously saved data, it is possible that you are opening the file using the wrong mode resulting the the file being overwritten instead of being appended to.

Without seeing the code involved, it is not possible to comment on it.
Eventless
post Aug 21 2011, 12:51 AM

Look at all my stars!!
*******
Senior Member
2,643 posts

Joined: Jan 2003
Hate to say this but most of your code is not necessary. The part that does the file exist checking, copy , delete and create new file can be removed. Use system.io.file to do the file handling. Use the appendtext method to open the file. This method will create the file if it does not exist and will add to the file when you do a write. The example on the appendtext page should give you the necessary information on how to proceed.
Eventless
post Aug 22 2011, 08:40 AM

Look at all my stars!!
*******
Senior Member
2,643 posts

Joined: Jan 2003
As long as it is doing an append instead of an overwrite,it should work.

Why is there a reader in the code? Probably a good idea to make sure nothing else is opening the file when writing to it.

So the only content of the file are spaces(" ")?

 

Change to:
| Lo-Fi Version
0.0123sec    0.36    6 queries    GZIP Disabled
Time is now: 13th December 2025 - 10:57 PM