Solved

Saving a Text File in vb 2005

Posted on 2014-10-13
1
170 Views
Last Modified: 2014-10-13
I would like to save a file in the format of a .txt file. My code below saves the file but I always need to go into properties of that file and select the open as. Also when I open the file there is nothing written in the file.... its blank.

Dim Veldata as new Arraylist

If Me.SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim Stream As FileStream = New FileStream(Me.SaveFileDialog1.FileName, FileMode.Create)
            Dim streamWriter As New StreamWriter(Stream)
            saveAs = Me.SaveFileDialog1.FileName

            'add the header information
            streamWriter.WriteLine(Now)
            streamWriter.WriteLine("Collected Data")

For intloop 0 to VelData.Count-1 
 streamWriter.WriteLine(Veldata(intloop)
Next
end if

Open in new window

0
Comment
Question by:cmdolcet
[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
1 Comment
 
LVL 9

Accepted Solution

by:
dustock earned 500 total points
ID: 40376967
Add in before your if statement

SaveFileDialog1.Filter = "Text Files | *.txt"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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