|
-
May 12th, 2009, 04:18 AM
#1
Thread Starter
New Member
problem with double and single quotes in string
Hi,
I have a problem with double and single quotes in a string.
I have a textbox where i take a string from.
In the textbox are double quotes and single quotes quotes.
Problem is that if i return the string all the single quotes are replaced by double quotes.
How can i get it to keep the single quotes as single quotes?
Thanks in advance
-
May 12th, 2009, 05:49 AM
#2
Re: problem with double and single quotes in string
Single quotes don't turn into double quotes on their own. Either it's not happening or your code is making it happen. We're going to need more information on the specifics of your application.
-
May 12th, 2009, 06:15 AM
#3
Thread Starter
New Member
Re: problem with double and single quotes in string
this is my code i'm using.
i have a webpage with 2 textboxes and a button.
Code:
If page.Ispostback then
dim oCodeZonder as string
dim oCodeMet as new system.text.stringbuilder
dim oNewLine as integer
dim teller as integer = 1
htmlDoc.GetElementbyId("codeVoorTry").innerHtml = page.Request("codeVoorTry")
oCodeZonder = page.Request("codeVoorTry")
oCodeMet.Append("Try" & vbcrlf & "errNum = " & teller.ToString & vbCrLf)
dim uitgaan as boolean
uitgaan = false
While uitgaan <> true
teller = teller+1
oNewline = oCodeZonder.IndexOf(vbCrLf)
if oNewLine = -1 then
uitgaan = true
oCodeMet.Append(oCodeZonder & vbCrLf)
oCodeMet.Append("errNum = " & teller.ToString & vbCrLf)
oCodeMet.Append("catch ex as exception" & vbCrLf & "throw new exception (errNum & ""-"" & ex.Message)")
oCodeMet.Append(vbCrLf & "end try")
else
oCodeMet.Append(Left(oCodeZonder, oNewLine))
oCodeMet.Append(vbCrLf & "errNum = " & teller.ToString)
oCodeZonder = oCodeZonder.Remove(0, oNewLine+1)
end if
end while
htmlDoc.GetElementbyId("codeNaTry").innerHtml = oCodeMet.tostring
end if
if for example i put this in the textbox:
oDetail.append("<tr><td>Section name</td><td><input type='text' id='afdelingNaamEng' name='afdelingNaamEng' value='" & cfc("afdelingnaam",1).ToString & "' runat='server'></td></tr>")
oDetail.append("<tr><td>Afdeling naam</td><td><input type='text' id='afdelingNaamNed' name='afdelingNaamNed' value='" & cfc("afdelingnaam",2).ToString & "' runat='server'></td></tr>")
it gives back this
oDetail.append("<tr><td>Section name</td><td><input type="text" id="afdelingNaamEng" name="afdelingNaamEng" value=""></td></tr>")
oDetail.append("<tr><td>Afdeling naam</td><td><input type="text" id="afdelingNaamNed" name="afdelingNaamNed" value=""></td></tr>")
-
May 12th, 2009, 06:56 AM
#4
Re: problem with double and single quotes in string
Right, so it's not your text box. The lack of any other information in your first post implies that it's your own TextBox in a WinForms application. It's important to provide the whole story.
-
May 12th, 2009, 04:39 PM
#5
Thread Starter
New Member
Re: problem with double and single quotes in string
owk so finally know what the problem is. apparantly if you write a string from vb.net to an aspx page the string gets changed.
the chars having problems are <, >, ", '. what i did to prevent this was using string.replace to replace these chars to html code " etc
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|