writing new lines with InnerText?
Hey Im having problems to write new lines with InnerText in a TableCell what im actualy doing is this:
Cell.InnerText = "something i wan to display in the first line"
Cell.InnerText += "something I would like to display in the second line"
I have tried everything, like using Chr(13), witeing the tag <br /> writing the tag using Chr() but it simply doesn't work. Is there any way or what im tring to do from vb is imposible?
Thanks
# 1 Re: writing new lines with InnerText?
Hi mate this is bhaskar
you should write like this...
message = "First line of code" + "\n";
message += "second line of code" + "\n";
message += "third line of code";
i hope it will help full to you..
# 2 Re: writing new lines with InnerText?
Nope, it still not working, besides thats C# syntax right? im using visual basic, ehat its actualy doing is writing the "\n" in the screen, it reemplaces the "\" for its representation in html "&..."
# 3 Re: writing new lines with InnerText?
WOW I missed it, i just solve it it was not hard, i realized i added html tags before in my project, this is what i did:
cell.InnetHtml = "string 1" & "<br />" & "string2"
it seems that InnerText converts everything to text, but InnerHtml don't
Thanks everyone!
# 4 Re: writing new lines with InnerText?
In Visual Basic, backslashes have no special meaning in strings. Instead, constants are used:
// C#
"Line \"One\"\r\nLine \"Two\""
' Visual Basic
"Line ""One""" & vbCrLf & "Line ""Two"""
There are constants for the other C-style escape sequences too (vbTab, for example).
So if you want to use InnerText in Visual Basic, you'll need to use the vbCrLf constant for linebreaks.
Also, quite obvious from the names, InnerHtml represents the HTML inside the element you're modifying, while InnerText represents the rendered text. InnerText cannot contain anything but pure text (so you need to use InnerHtml or DOM to make bold text, etc.)
# 5 Re: writing new lines with InnerText?
WOW I missed it, i just solve it it was not hard, i realized i added html tags before in my project, this is what i did:
cell.InnetHtml = "string 1" & "<br />" & "string2"
it seems that InnerText converts everything to text, but InnerHtml don't
Thanks everyone!
Ummmm.. InnerText, InnerHtml...
Why do you think they have two different methods???