Solved

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

Posted on 2011-03-11
2
275 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 500 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now