Solved

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

Posted on 2006-10-19
4
268 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks guys!!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

15 Experts available now in Live!

Get 1:1 Help Now