Error on creating a text file to write lines

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: JenHu (jenniferhu46_at_hotmail-dot-com.no-spam.invalid)
Date: 01/06/05


Date: 6 Jan 2005 14:56:11 -0600

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
*-----------------------*