Re: StreamWriter Problem



On Dec 8, 8:35 pm, "Teemu" <tsir...@xxxxxxxxxxx> wrote:
"kimiraikkonen" <kimiraikkone...@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 thishttp://software.techrepublic.com.com/download.aspx?&kw=File+lock&doci...
to check out which process has locked the file when the exception occurs.

-Teemu

Hi,
Thanks for the tool but it did nothing, however this problem happens
very rarely for the latest code that i've edited, but and happened
again. With exception window is stayed open, i used the tool you
recommended, but it didn't report any process that locks my text file,
only says: "You do not have sufficient access to 1 processes". I have
all the rights as i'm admin, and i saw some right-related problem
about that exception, but i couldn't find an exact solution.

Additionaly, to test the tool which you pointed out, while an mp3
audio file is being played by a player, i used that tool to report if
it reports correct process(player) as it's used by, but nothing is
reported. This tool is not reliable.
.



Relevant Pages

  • Re: Problem with "handles" - possible garbage collection issue?
    ... | The symptom that users report is that after they have been using the ... You may want to include one or more Global Exception handlers in your ... Use AddHandler in your Sub Main. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Finding Error in Applet.
    ... If you report the situation inaccurately, advice given will be inaccurate and likely useless. ... Sometimes 1 in 10 times it hangs. ... If an Exception or Error or any other Throwable were thrown, you'd have gotten a message to that effect already. ... A good logging package, like the inbuilt java.util.logging package or the open-source log4j library, can report the type of information you seek. ...
    (comp.lang.java.programmer)
  • Re: cannot access IE
    ... We have created an error report that you can ... >> vendor code, bla bla. ... Module 1 Image base, Image ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • XLANGPart.LoadFrom(stream) failing - UnauthorizedAccessException
    ... My component then generates a PDF stream using Crystal Reports, ... attempts to load the XLANGMessage's 1st data part with the stream generated ... ReportDocument report = new ReportDocument; ... Exception thrown from: segment 1, ...
    (microsoft.public.biztalk.general)
  • Re: cannot access IE
    ... We have created an error report that you can ... >> vendor code, bla bla. ... Module 1 Image base, Image ...
    (microsoft.public.windows.inetexplorer.ie6.browser)

Loading