Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-10-19
4
Medium Priority
?
279 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 400 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 600 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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 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