• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 332
  • Last Modified:

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

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

I am going through the article:

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?
1 Solution
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")

Open in new window

Mr_ShawAuthor Commented:
Your code did the trick...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now