views:

21

answers:

1

Hi,

I'm trying to assign the following HTML as a value to variable type string

    'here's the tag 
   '$("#close").click(function(){$.notifyBar({ html: "Click 'close' to hide notify bar", close: true, delay: 1000000 });});

        Dim htmltag = "$("#close").click(function(){$.notifyBar({ html: "Click 'close' to hide notify bar", close: true, delay: 1000000 });});"

I got a lot error message about the quotation in the string.

A: 

You need to use escape characters on the quotations otherwise they break the variable input. The VB.net escape for quotations is double quote:

Dim htmltag = "$(""#close"").click(function(){$.notifyBar({ html: ""Click 'close' to hide notify bar"", close: true, delay: 1000000 });});"

In your example, the compiler would see the string as:

Dim htmltag = "$("

With lots of unknown stuff after it!

Other languages have different escape characters, javascript for example is backslash.

Tom Gullen