🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #667

Re: 'File in use' error after File.Create()

#667
From: Tor Iver Wilhelmsen
Date: Thu, 23 Sep 2004 08:04
14 lines
1430 bytes
John Fowler <jfowler@pXoXl.net> writes:

> File.Create( saveFile );

Why not keep the returned (open) Stream?

As another poster pointed out, Create() not only creates the file, it
also opens it for writing.

> myFlexGrid.SaveGrid( saveFile, FileFormatEnum.TextComma );

The SaveGrid method probably tries to "reopen" the file, so it needs
to be closed. Or, if it's an API you control, try using the FileStream
you got from Create() instead of the name, and write to that.
Technical Details
Message-ID: <uekkto1h7.fsf@broadpark.no>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4152442d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,371711e74f47af5a
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
Sender: Tor Iver Wilhelmsen@TIWILHEL
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: Re: 'File in use' error after File.Create()
References: <4152442d$1@newsgroups.borland.com>
From: Tor Iver Wilhelmsen <tor.iver.wilhelmsen@broadpark.no>
Date: 23 Sep 2004 10:04:20 +0200
Message-ID: <uekkto1h7.fsf@broadpark.no>
Lines: 14
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
NNTP-Posting-Host: 80.203.79.252
X-Trace: newsgroups.borland.com 1095926319 80.203.79.252 (23 Sep 2004 00:58:39 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail