473,749 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Locking Files

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

Nov 21 '05 #1
2 2079
On 13 Sep 2004 20:02:34 GMT, Joecx wrote:
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


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
--
Tom Shelton [MVP]
Nov 21 '05 #2
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
From: Tom Shelton to*@YOUKNOWTHED RILLmtogden.com
Date: 9/14/2004 12:26 AM Central Standard Time
Message-id: <1c************ *************** **@40tude.net>

On 13 Sep 2004 20:02:34 GMT, Joecx wrote:
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


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
--
Tom Shelton [MVP]

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1811
by: Geoffrey | last post by:
We have developed a python class that can read data files created from another application. These target files are C-ISAM files used for accounting applications so the "primary" application may be reading and/or writing to portions of the files ("records") at the same time. The python class we developed opens the requested file in 'rb' mode, reads the file header (first 512k) and using information supplied in the file header (such as...
4
3507
by: Sam | last post by:
Hello everyone, I have around 20 reports in an ASP web-application which connects to a SQL Server 2000 dB, executes stored procedures based on input parameters and returns the data in a nice tabular format. The data which is used in these reports actually originates from a 3rd party accounting application called Exchequer. I have written a VB application (I call it the extractor) which extracts data from Exchequer and dumps the same...
3
2768
by: Wolfgang Bachmann | last post by:
We migrated a database from Version 5.1 to 8.1 and are experiencing massive locking problems. We migrated in the following steps: 0) Server 5.2, Clients 5.2: everithing was fine 1) Server 5.2, Clients 6.1: everything still fine 2) Server 8.1, Clients 6.1: here the problem occurs 3) server 8.1, Clients 8.1: not yet done. Steps 1 & 2 were nessecary because there are to many clients spread over to much area to migrate all at once from...
15
6201
by: z. f. | last post by:
Hi, i have an ASP.NET project that is using a (Class Library Project) VB.NET DLL. for some reason after running some pages on the web server, and trying to compile the Class Library DLL, it can't compile because the DLL is in use (and the PDB too), and the w3wp.exe process is the process locking the DLL (as viewed with Sysinternals - Process Explorer). this is a huge problem. i need to do IIS reset in order to free the DLL! 1. why is...
0
899
by: alex | last post by:
I have few web pages that allow to upload, delete, etc images (.jpg, ..bmp, .gif) Once the page is doen working with file thru Bitmap class I close file handles as: Bitmap bmp = new Bitmap(...); //some code bmp.Dispose(); bmp = null;
5
3953
by: Adrian | last post by:
Is there a way to lock records and/or files in multi user application, using C#? Adrian.
4
9554
by: John please don't spam me! | last post by:
VB.Net 2003 Hi, 2 questions: 1. I want to read a file in without locking it, as it is Log file. 2. I want to be able to read from the last point it wa read upto. The project is: Search through ftp log files for certain files download to our ftp site. This will be on a schedule so I would like to pass to my database the point (in bytes) where I have read upto. Then next time I check it I want to only
15
5249
by: Matt Brandt | last post by:
I am trying to get multiple threads to lock specific regions of a file. However, since each thread has the same PID, it appears that a lock by one thread does not block another thread from the same process. How does one maintain file locking between sibling threads? - Matt
7
1854
dlite922
by: dlite922 | last post by:
I need to do some sort of Locking mechanism at interface level, instead of DB Level. I know how MySQL table locking works, but that won't work in my scenerio. Requirements: When someone is editing a case, for example changing the persons info, editing the violations/charges they have, etc... I don't want another user to have pulled the same case and one of them clicks Update or Save before the other. So the case is locked for...
3
2102
by: HugoVallejo | last post by:
Hi everyone. I've created an ASP.NET web site which uses a .NET assembly to read/write operations using an odbc driver. When a connection to the odbc database is made locking files are created, when the connection is closed those files are removed. I tried the web site using VS2005 and it worked fine. Then I published it in IIS 5.1 (WIn XP SP2) but it didn't work. I thought because write permissions on the folder of the database. So I...
0
9566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6800
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.