General discussion

Locked

Delimiters in VB

By nkelly ·
I am new to Visual Basic and am trying to read a sequential file. Can you change the delimiter of a string to something other than quotes?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Delimiters in VB

by Result In reply to Delimiters in VB

The Write # statement writes data in a consistent and fixed format, which ensures the data can be read in any locale. If this is not the behavior you want, you can use Print #, which will write data to a sequential file as it would appear on the screen. For example:

Open "C:\MyTest.txt" For Output As #1

Write #1, "Test String with Write"
Print #1, "Test String with Print"

Close #1

If you were to open up MyTest.txt in Notepad, the output would be:

"Test String with Write"
Test String with Print

Collapse -

Delimiters in VB

by nkelly In reply to Delimiters in VB

Thanks for the assistance and sorry I did not reply sooner.. I guess I was not clear. I can write/print the file BUT I need to get rid of the quotes around the string (" ") and the commas (,) between fields as I need to use this file in anotherapplication that does not accept " (quotes) and , (commas) in fields. Thanks for responding...

Collapse -

Delimiters in VB

by awilliams3 In reply to Delimiters in VB

Review the following Microsoft Knowledge Base article:

XL: Procedure to Export Text File with Comma AND Quote Delimiter
http://support.microsoft.com/support/kb/articles/Q123/1/83.asp?LN=EN-US&SD=gn&FR=0

Though the article is written for Excelthe code itself demonstrates the importing of a text file with multiple delimiters. With the exception of depositing the data to a worksheet this code will work in Visual Basic, changing the destination of the imported text to a control, a databasetable, or even a worksheet, etc.

Collapse -

Delimiters in VB

by nkelly In reply to Delimiters in VB

Thanks for responding... I did see the article I have not tried that method.. I was just hoping that there was a simpler solution. (i.e. A command/agruement that would allow you to write to a file without using special characters..)

Collapse -

Delimiters in VB

by nkelly In reply to Delimiters in VB

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums