Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using VB I want to create a new text file and write a line of text.

Posted on 2011-03-11
2
Medium Priority
?
330 Views
Last Modified: 2012-05-11
Using VB I want to create a new text file and write a line of text.

I am going through the article:
http://www.techrepublic.com/article/read-and-write-text-files-with-visual-basic-net/1045309

I have managed to create a new text file.

I now want to write a line to the text file.

When I execute my WRITE code I get an error.

I think this because of create method is still holding on to the file.

How do I release the file to allow me to write to it?
0
Comment
Question by:Mr_Shaw
2 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 35107755
Can you show what you have so far ...

Easiest example to create a file and write to it

   
Dim TextFile As New StreamWriter("test.txt")
    TextFile.WriteLine("Line 1")
    TextFile.WriteLine("Line 2")
    TextFile.Close()

Open in new window

0
 

Author Closing Comment

by:Mr_Shaw
ID: 35107829
Your code did the trick...

thanks
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question