Quotes in textbox

davelew1s

Active Member
Licensed User
Longtime User
Hi!
I've searched the forum but not found anything about this.....if I use the 'designer' and create a textbox, enter some text with quotes that's OK but when I exit the designer the quotes are removed, is this correct?
Thanks Dave lewis.
 

derez

Expert
Licensed User
Longtime User
If you want to have " as part of a string, you either use two ' instead or use the ascii code : [string start] & chr(34) & [string end]
 

davelew1s

Active Member
Licensed User
Longtime User
If you want to have " as part of a string, you either use two ' instead or use the ascii code : [string start] & chr(34) & [string end]

Hi!
I understand the above but it does not work in the 'designer'
What I am trying to do is preload a textbox in the designer then use it in my application, but the quotes are removed on exiting the designer. The text is part of a .kml file which I save and use in Google Earth.
Dave.
 

derez

Expert
Licensed User
Longtime User
I don't understand why you need to work with the designer on this issue.
Whatever you design by the designer is written as code at the beginning of the sbp file, check by opening it with notepad.
For example -the following line taken from there define a textbox which would have the text of "Textbox1" even if I put quotes in the middle. I added two ' instead and this holds.
B4X:
addtextbox(form1,TextBox1,95,95,75,22,"Text''Box1",255,255,255,0,0,0,True,True,False,9)@

To sum it all up - you have to define your textbox text in the code:
textbox.text = "xxxx''yyyy"
 
Top