Solved

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

Posted on 2006-10-19
4
275 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
[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
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 86

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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