Write a line in a text file with quotes in it

  • Follow


Hi All. 

I need to write a line in a text file that contains quotes I need the output
to be:

"NotifyRouterUpdate"="EM"

I've tried encapsulating the entire string in another set of qoutes: 
filetxt.WriteLine (""NotifyRouterUpdate" = "EM"")

but I am getting an error:

Compile Error:

Expected: list seperator or )

Thanks

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201001/1

0
Reply cdiaz1116 1/6/2010 8:59:17 PM

cdiaz1116 via AccessMonster.com wrote:
>I need to write a line in a text file that contains quotes I need the output
>to be:
>
>"NotifyRouterUpdate"="EM"


You need to use two quotes when you want one inside the
text.

	"NotifyRouterUpdate""=""EM"

-- 
Marsh
MVP [MS Access]
0
Reply Marshall 1/6/2010 10:46:09 PM

On Wed, 06 Jan 2010 20:59:17 GMT, "cdiaz1116 via AccessMonster.com"
<u56890@uwe> wrote:

>Hi All. 
>
>I need to write a line in a text file that contains quotes I need the output
>to be:
>
>"NotifyRouterUpdate"="EM"
>
>I've tried encapsulating the entire string in another set of qoutes: 
>filetxt.WriteLine (""NotifyRouterUpdate" = "EM"")
>
>but I am getting an error:
>
>Compile Error:
>
>Expected: list seperator or )
>
>Thanks

A quoted string starts with a " and ends with the next " - so you're getting a
zero length string "", followed by an (UNQUOTED!) text NotifyRouterUpdate,
followed by a text string " = " and so on.

The trick to include a doublequote inside a string delimited by doublequotes
is to double the doublequote: "" inside a string constant will be interpreted
as a " character. So try

filetxt.WriteLine ("""NotifyRouterUpdate"" = ""EM""")

-- 

             John W. Vinson [MVP]
0
Reply John 1/6/2010 10:55:08 PM

2 Replies
797 Views

(page loaded in 0.121 seconds)

Similiar Articles:
















7/14/2012 5:48:28 AM


Reply: