Solved

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

Posted on 2011-03-11
2
313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to set focus on a dynamic control 18 52
How do i create a simple array in a public class? 6 37
Subtract dates in vb.net 6 35
vb.net code 9 28
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…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

751 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