I have to open a files for reading, which is currently being used by another
process(say file X). I could open file X in notepad, without any issues. How
can I open it in vb.net? I always get an error saying that file is being used
by another process. Any help please. 4 2068
Try to open the file in read-only mode it should work. Even in notepad
if you try to save the opened document it won't let you.
Sijin Joseph http://www.indiangeek.net http://weblogs.asp.net/sjoseph
sam wrote: I have to open a files for reading, which is currently being used by another process(say file X). I could open file X in notepad, without any issues. How can I open it in vb.net? I always get an error saying that file is being used by another process. Any help please.
Try to open the file in read-only mode it should work. Even in notepad
if you try to save the opened document it won't let you.
Sijin Joseph http://www.indiangeek.net http://weblogs.asp.net/sjoseph
sam wrote: I have to open a files for reading, which is currently being used by another process(say file X). I could open file X in notepad, without any issues. How can I open it in vb.net? I always get an error saying that file is being used by another process. Any help please.
Hi Sam,
If the file can be opened by Notepad then you should be able to open it in
your program too. Specify that you only need to Read the file and Share
it.
Simply using File.OpenRead() might work, or you can do a more complex
File.Open Method (filename, FileMode.Open, FileAccess.Read ,
FileShare.ReadW rite)
(Not entirely sure what would be the best FileShare selection, you might
want to try the various options).
--
Happy Coding!
Morten Wennevik [C# MVP]
Hi Sam,
If the file can be opened by Notepad then you should be able to open it in
your program too. Specify that you only need to Read the file and Share
it.
Simply using File.OpenRead() might work, or you can do a more complex
File.Open Method (filename, FileMode.Open, FileAccess.Read ,
FileShare.ReadW rite)
(Not entirely sure what would be the best FileShare selection, you might
want to try the various options).
--
Happy Coding!
Morten Wennevik [C# MVP] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: RSB |
last post by:
Hi Every one,
I am currently using Visual Studio .Net and trying to open a project from
SourceSafe and once i open the project for the first time i get the
following error/warning...
"The binding information for this solution could not be retrieved from its
source control provider. This solution may have been placed under source
control with a different provider configuration from the current one.
To keep source control working for...
|
by: sam |
last post by:
I have to open a files for reading, which is currently being used by another
process(say file X). I could open file X in notepad, without any issues. How
can I open it in vb.net? I always get an error saying that file is being used
by another process. Any help please.
|
by: Peter Schmitz |
last post by:
Hi,
I'm just trying to play a *.wav file, making use of the unmanaged function
"sndPlaySoundA" in winmm.dll, but I still got one question: How can I avoid,
that the sound file itself has to be seperate file in a specific directory,
but instead 'integrate' it in my application?
Thanks
peter
|
by: Daniel |
last post by:
if System.IO.StreamWriter write throws an exception, is there anyway to
close the System.IO.StreamWriter object? it seems to stay open when this
happens then future attempts to write to that same path fail because it says
its in use by another process.
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
| |
by: kk.simhadri |
last post by:
Hi everybody,
I want to run a bat file which is on different PC in the same network.
I am able to run a batch file in my PC through the following code
<%
set wshell = CreateObject("WScript.Shell")
wshell.run "c:\file.bat"
set wshell = nothing
|
by: thirunavukarasukm |
last post by:
Hai....
"i want used confirm in javascript in code behind"
i am used confirm button ,,,in code behind.
if the confirm button worked
the function is return the true...
|
by: aaron.watters |
last post by:
Hi. I'm writing an archival system which I'd like to be portable
to Windows.
The system relies on the property of Unix which allows a
process to keep a file open even if another process renames
it while it is open. Neither process sees any anomaly or
error.
Do the NT file systems support this feature (which I think is
standard for POSIX systems)?
|
by: JaxDawg |
last post by:
I have a spreadsheet saved as an XML spreadsheet so I can manipulate
it easier (and don't need COM). When I'm done, I want to display to
the user. Currently, I'm using simple JavaScript in my PHP file to
display the file when complete:
echo '<script type="text/javascript"window.open("'.$file_nm.'")</
script>';
Since the file is .XML, which defaults to the browser to open - the
above code will display the XML as raw XML (text) in a new...
|
by: trixxnixon |
last post by:
i have a form that is being designed to pend requests in a requests database.
the pend form is opened from an update form used by an employee to enter updates. when the pend form is updated, the tracking number of the current request is imported to the pend form, and query results are displayed at the bottom(all previous pending records for the imported tracking number)
the pend button saves either the start pending date or the end pending...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |