Solved

Removing double quotes from a a CSV file being created.  VB 2005

Posted on 2006-10-19
4
271 Views
Last Modified: 2008-02-01
Hello,
 
I found several similar posts, but the documented solution didn't work for my program.

Here's my CSV file opened in Notepad:

"JF7","10192006","ARP","0.4"

The file would be good if I could drop all of the "



Here's my string values, I tried the ("""""", """") but didn't make a different  (I had to use double quotes around old value and new value to avoid error about quot not being declared)

CompanyCode = "JF7"

strCurrentDate = CurrentDate.ToString("MMdyyyy").ToString
strCurrentDate.Replace("#", "")
strCurrentDate.Replace("""""", """")

RegHrs = dsADP.Tables("tblTA_ADP_Hrs").Rows(i)("Regular_Hours").ToString



Here's my file creation:

WriteLine(1, CompanyCode, strCurrentDate, Emp, RegHrs)


Please help!

Thanks,
Jon
0
Comment
Question by:JMO9966
  • 2
4 Comments
 
LVL 10

Assisted Solution

by:gangwisch
gangwisch earned 100 total points
ID: 17767542
read in the csv file
dim a as string= myfilestream.readtoend()
a=replace(a,chr(34),"")

write to csv file
a contains your whole file
0
 

Author Comment

by:JMO9966
ID: 17768657
Thanks Gangwisch,

I get an error on the last line here.  It doesn't like my (a) argument I'm passing??


        Dim ADPFile As StreamReader
        Dim ADPFileOutput As StreamWriter

        ADPFile = File.OpenText("c:\jb\custom programs\adp\adp.csv")

        Dim a As String = ADPFile.ReadToEnd()
        a = a.Replace(Chr(34), "")

        ADPFileOutput = File.WriteAllLines("c:\jb\custom programs\adp\PRJ7FEPI.csv", a)
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 150 total points
ID: 17768864
You appear to be using VB.Net 2005:

        Dim inFile As String = "c:\jb\custom programs\adp\adp.csv"
        Dim outFile As String = "c:\jb\custom programs\adp\PRJ7FEPI.csv"
        File.WriteAllText(outFile, File.ReadAllText(inFile).Replace(Chr(34), ""))
0
 

Author Comment

by:JMO9966
ID: 17769402
Thanks guys!!
0

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.

Question has a verified solution.

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

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

831 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