Re: StreamWriter Problem
- From: "Teemu" <tsirkia@xxxxxxxxxxx>
- Date: Sat, 8 Dec 2007 20:35:57 +0200
"kimiraikkonen" <kimiraikkonen85@xxxxxxxxx> kirjoitti viestissä news:6b5e9f3a-f116-47d0-85ac-f5a089f4e445@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Teemu and Tom,
I'm currently using this code for "try" area with getting this
exception rarely but
not solved completely:
myStreamWriter = System.IO.File.CreateText(Save.FileName)
myStreamWriter.Write(TextBox1.Text)
myStreamWriter.Flush()
myStreamWriter.Close()
myStreamWriter.Dispose()
However, i added a "yesnocancel" msgbox question inside exception area
against the problem, when this exception occurs user can retry save
process
or cancel save process. At least this does it temporarily but i wish
i didn't have to yesnocancel question prompt to retry save process.
Your problem sounds so weird that I can't figure out any reason for this if the file is really not used by another program.
Maybe you could use a tool like this http://software.techrepublic.com.com/download.aspx?&kw=File+lock&docid=211273 to check out which process has locked the file when the exception occurs.
-Teemu
.
- Follow-Ups:
- Re: StreamWriter Problem
- From: kimiraikkonen
- Re: StreamWriter Problem
- From: kimiraikkonen
- Re: StreamWriter Problem
- References:
- StreamWriter Problem
- From: kimiraikkonen
- Re: StreamWriter Problem
- From: kimiraikkonen
- Re: StreamWriter Problem
- From: Tom Shelton
- Re: StreamWriter Problem
- From: kimiraikkonen
- Re: StreamWriter Problem
- From: Tom Shelton
- Re: StreamWriter Problem
- From: kimiraikkonen
- StreamWriter Problem
- Prev by Date: Re: StreamWriter Problem
- Next by Date: Re: Toggle Button
- Previous by thread: Re: StreamWriter Problem
- Next by thread: Re: StreamWriter Problem
- Index(es):
Loading