473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Error on creating a text file to write lines

Hi all,

I want to create a text file to write lines, but it gives me an error
on Dim sw As New StreamWriter(CreatePath & Efilename) :
System.IO.IOException: The process cannot access the file
"C:\temp\DD_01062005.txt" because it is being used by another
process.

Can someone point me out where did I do wrong? Thanks.

------------------------------------------------------------------
Dim CreatePath As String = "C:\temp\"
Dim Efilename As String = "DD_" & Format(Date.Today,
"MMddyyyy").ToString & ".txt"
File.Create(CreatePath & Efilename)
Dim sw As New StreamWriter(CreatePath & Efilename)

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #1
1 1149
Sounds like you opened this file at some point, but never closed it. So it
is still locked by the other object you used to access it. Make sure you
always close any stream that accesses your file.

You will probably need to restart asp.net to release the file lock.

"JenHu" <je**********@hotmail-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
Hi all,

I want to create a text file to write lines, but it gives me an error
on Dim sw As New StreamWriter(CreatePath & Efilename) :
System.IO.IOException: The process cannot access the file
"C:\temp\DD_01062005.txt" because it is being used by another
process.

Can someone point me out where did I do wrong? Thanks.

------------------------------------------------------------------
Dim CreatePath As String = "C:\temp\"
Dim Efilename As String = "DD_" & Format(Date.Today,
"MMddyyyy").ToString & ".txt"
File.Create(CreatePath & Efilename)
Dim sw As New StreamWriter(CreatePath & Efilename)

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 19 '05 #2

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

Similar topics

1
by: dmiller23462 | last post by:
Hey guys.... I put an error-handling in my page and have it posted at the complete end of the code, see below(when people were putting in 's I was getting the delimiter errors). Great, I...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
1
by: David Li | last post by:
I am having a lot of problem with following code. To start with I have a working sets of code and the top level SystemC code looks like this: ----------working main.cpp start here...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
7
by: | last post by:
Hi all, I have a simple .aspx page running on net 2.0 that is trying to do a http post to a remote server. Here is the code Private Function ProcessRequests(ByVal strbody As String) As String...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.