Results 1 to 11 of 11

Thread: Can't stop writing these stupid """"

  1. #1

    Thread Starter
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186

    Can't stop writing these stupid """"

    I think my problem is that I'm trying to write a string to a text file, and VB must automatically add the "" to the front and back of any string when writing it to a text file. Is there a way to keep this from happening? I tried trimming the quotes off before writing but no luck. Maybe I'm doing something wrong.
    VB Code:
    1. Dim textfileData As String
    2.  
    3. Open Filename For Output As #1
    4.     textfileData = Replace(textfileData, Chr$(34), "")
    5.     Write #1, textfileData
    6. Close #1
    Any suggestions?
    Place Your VBForums Ad Here

  2. #2

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Change Write to Print.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    It is the write commant.. Use Print instead..

    Rudy
    10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".

  5. #5

    Thread Starter
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186
    Wow, so freaking easy. Thanks for all the replies guys. Is there a situation where you would ever choose Write over Print?
    Place Your VBForums Ad Here

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    If you want the quotes! LOL
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    Originally posted by Cander
    If you want the quotes! LOL
    Can't argue with that!




    Rudy
    10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".

  8. #8
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    heh. Well there may be a logical reason, but I don't have a clue.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  9. #9
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    Originally posted by Cander
    heh. Well there may be a logical reason, but I don't have a clue.

    The only possible reason I can come up with is that you are Appending to an existing file and want to be able to sort out what was written by the program from the origional text..
    10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".

  10. #10
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    If your information is likely to have commas in it then you are better off encapsulating everything in " because otherwise anything reading your CSV file later will get confused otherwise.
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  11. #11

    Thread Starter
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186
    I see your point but in my case my CSV is actually a semi-colonSV file. If you delimitter is anything other than a comma, it's kind of silly I think
    Place Your VBForums Ad Here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width