![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: May 2006
Posts: 51
Rep Power: 3
![]() |
Small C# Problem - quotation marks in string
Hi, im having trouble with quotation marks in a string.. here is the code that is bugging me..
html.WriteLine("<img src=""images//" & file & """ />");i need it to output the line as follows: <img src="images/imagename.jpg" /> the imagename.jpg is define in the file string. the errors are as follows: Error 1 ) expected C:\Documents and Settings\Jason\My Documents\Visual Studio 2005\Projects\Project01\Project01\Form1.cs 63 43 Project01 Error 2 ; expected C:\Documents and Settings\Jason\My Documents\Visual Studio 2005\Projects\Project01\Project01\Form1.cs 63 65 Project01 Error 3 ; expected C:\Documents and Settings\Jason\My Documents\Visual Studio 2005\Projects\Project01\Project01\Form1.cs 63 70 Project01 Error 4 Invalid expression term ')' C:\Documents and Settings\Jason\My Documents\Visual Studio 2005\Projects\Project01\Project01\Form1.cs 63 70 Project01 thanks in advance... |
|
|
|
|
|
#2 |
|
Newbie
|
Use the escape sequence \" to display the quotation mark otherwise it will exit the string literal in the function argument.
html.WriteLine("<img src=\"images//\" & file & "\" />"); Or something along those lines. |
|
|
|
|
|
#3 | |
|
Programmer
Join Date: May 2006
Posts: 51
Rep Power: 3
![]() |
Quote:
![]()
__________________
AMD Athlon X2 4200+ -- Asus V3-M2V890 -- 2GB Kingston -- Vista Ultimate 32bit + Ubuntu 8.04 Intel C2D T5870 2.0GHZ -- Vostro 1510 -- 2048MB -- Windows XP SP2 ASCII stupid question, get a stupid ANSI ! |
|
|
|
|
|
|
#4 |
|
Sexy Programmer
|
Try this:
html.WriteLine("<img src=\"images//\"" + file + "\" />");
__________________
I would love to change the world, but they won't give me the source code! |
|
|
|
|
|
#5 |
|
Newbie
|
Ah, one quotation mark off, didn't spot that *headache looms*
|
|
|
|
|
|
#6 | |
|
Programmer
Join Date: May 2006
Posts: 51
Rep Power: 3
![]() |
Quote:
there were so many question marks i couldn't get my head round them all lol! :banana:
__________________
AMD Athlon X2 4200+ -- Asus V3-M2V890 -- 2GB Kingston -- Vista Ultimate 32bit + Ubuntu 8.04 Intel C2D T5870 2.0GHZ -- Vostro 1510 -- 2048MB -- Windows XP SP2 ASCII stupid question, get a stupid ANSI ! |
|
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: Nov 2006
Location: 163H
Posts: 213
Rep Power: 2
![]() |
You can use the @ before the strign, if i am not mistaken like :
@"<img src=""images//" & file & "" />"
__________________
You never test the depth of a river with both feet. The believer is happy. The doubter is wise. Free speech carries with it some freedom to listen. The next generation will always surpass the previous one. It`s one of the never ending cycles of life. |
|
|
|
|
|
#8 | |
|
Programmer
Join Date: May 2006
Posts: 51
Rep Power: 3
![]() |
Quote:
thanks
__________________
AMD Athlon X2 4200+ -- Asus V3-M2V890 -- 2GB Kingston -- Vista Ultimate 32bit + Ubuntu 8.04 Intel C2D T5870 2.0GHZ -- Vostro 1510 -- 2048MB -- Windows XP SP2 ASCII stupid question, get a stupid ANSI ! |
|
|
|
|
|
|
#9 | |
|
Newbie
|
Quote:
Cheers for the tip, pegasus. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| An Attempt at a DBMS | grimpirate | PHP | 8 | Apr 17th, 2007 1:01 PM |
| Function Parameters | grimpirate | PHP | 10 | Mar 14th, 2007 6:55 PM |
| C# corruption!!! | Kilo | C++ | 32 | May 21st, 2006 8:44 PM |
| Array issues :( | Alo Tsum | Java | 10 | Nov 26th, 2005 5:45 PM |
| replace space with ' * ' | TecBrain | C++ | 15 | Apr 13th, 2005 12:32 PM |