Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 31st, 2011, 01:55 PM
Registered User
 
Join Date: May 2011
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default File release

I am trying to get info to go into a file. The problem I am having is once I create the file and then try to write to it it says the file is being used by another process. Does anyone know how to release the file after it has been created using the System.IO.file

Thank you
Jeremy
Reply With Quote
  #2 (permalink)  
Old May 31st, 2011, 08:54 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,190
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there..

flush and dispose??

But you have to wait a little until the OS realize that the file is alone...

Anyway, why using two diferent process?? you can create the file opening a stream for writting....
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Reply With Quote
  #3 (permalink)  
Old June 4th, 2011, 09:15 AM
Friend of Wrox
Points: 1,075, Level: 12
Points: 1,075, Level: 12 Points: 1,075, Level: 12 Points: 1,075, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

when you create a file, you can create it and append to it in 1 instance, you dont have to create a file, close it, then re open it for editing.

So you would do something like

Code:
Dim fStream As New FileStream("mytxt.txt", FileMode.OpenOrCreate)
        Dim tStream As New StreamWriter(fStream)

        ' Do what ever writing you need to, or what ever reading you need

        tStream.Flush()
        fStream.Flush()
        tStream.Dispose()
        fStream.Dispose()
__________________
Apocolypse2005, I'm a programmer - of sorts.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
File release Jeremy.Carter Javascript How-To 2 May 27th, 2011 04:54 AM
Release Date tlpearceii BOOK: Silverlight 4 Problem - Design - Solution 0 April 22nd, 2010 01:11 PM
debug vs. release xagutxu Visual C++ 0 September 16th, 2009 07:46 AM
Need to release file after File.Create... VBtyler Visual Basic 2008 Essentials 2 May 19th, 2009 07:12 AM
Release problem jeusdi .NET Framework 1.x 0 February 27th, 2007 10:19 AM



All times are GMT -4. The time now is 07:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.