Double quotes in string
I am trying to assign a virtual directory path to a variable, but I think the double quotes are messing up the syntax. Is there a substitute character to use? I've seen the post about using single quotes, but I'm not sure where to put them.
This is what I'm trying to get into the Assign:
<a href=" + FilePath + " target="_blank"> Property Easement </a>
where FilePath is the variable storing the path to the file.
Any help would be appreciated.
-
Hi Michael
Try using"
"<a href=" + char(34) + FilePath + char(34) + " target=" + char(34) + "_blank" + char(34) + "> Property Easement </a>"
Regards
Ralph
PS you may need to add to the Imports Microsoft.VisualBasic
0 -
Ralph,
Thank you for the help.
I was able to get the expression I needed by splitting it up into 5 different variables and then combining them into a sixth variable. Not pretty, but it worked.
I would prefer one string like you suggested. When I use the string you gave me, I get a compiler error:
Compiler error encountered processing expression: '.' expected
I did add Microsoft.VisualBasic to the Imports.
Any thoughts?
Thanks again for the response,
Mike
0 -
Hi Mike
the Char should have been Chr
Sorry about that.
Regards
Ralph
0 -
I always recommend using String.Format, which makes things a little easier to read. To use embedded quotes in the string, double them, or use single quotes:
String.Format("<a href=""{0}"" target=""_blank"">Property Easement</a>", FilePath)
or
String.Format("<a href='{0}' target='_blank'>Property Easement</a>", FilePath)
0
Please sign in to leave a comment.
Comments
4 comments