Groups | Blog | Home
all groups > vb.net > september 2004 >

vb.net : Locking Files


joecx NO[at]SPAM aol.com
9/13/2004 8:02:34 PM
Hi
I am trying to understand what the lock feature does in vb.net.
I am using a text file.

I have created an instance of the filestream using fs and I am using the
following line:

fs.lock(0, fs.length)

When I set this up using the function instead of name spaces, it locks me out
of bring it up in notepad (which is the desired result).

But when I use the fs.lock method, it doesn't seem to accomplish anything.

Can someone explain what the .net lock feature is suppose to do and maybe would
you have some sample code I could see to make sure I am using it correctly?

Thanx if anyone can help!!!!!

Joe
Tom Shelton
9/13/2004 11:26:20 PM
[quoted text, click to view]

Joe,

I'm a little unclear here - and maybe are others... Can you give some
example code and be a little more concise as to what your issue/question
is?

Thanks
--
joecx NO[at]SPAM aol.com
9/20/2004 11:28:02 PM
Thanks for responding........basically I am trying to figure out how to use the
namespace lock feature of dot.net.

I want to lock a text file while modifying it during the run of a program and
then unlock it after I finish modifying it. I don't even want someone to be
able to read it in a text editor during that time. I hope this clarifies what
I am trying to do.

Thanks again!
Joe>Subject: Re: Locking Files
[quoted text, click to view]

AddThis Social Bookmark Button