Solved

Saving a Text File in vb 2005

Posted on 2014-10-13
1
169 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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with adding DLL file in Windows project 20 46
vb.net 1 month apart 11 38
VB/ASP.Net "Value of type 'Date' cannot be converted to 'Integer'" 12 42
Get sourcecode path 14 46
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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