cancel
Showing results for 
Search instead for 
Did you mean: 

new line in textview?

Liesbeth
Explorer
0 Kudos

Hi all

How can I start a new line in a textview?

I tried the following, but it doesn't work:

me.textview1.text = "firstline" & vbCrLf & "secondline"

Many thanks!

Liesbeth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

So the bad news are that since what you write in the text property of the TextView will be rendered to html the vbCrLf will not work, since it has no meaning in html. In fact, you couldn't use "<br>" either, since it will be encoded (to ensure you don't ever "break" it's rendering).

The good news are that TextView supports Wrapping and a special layout... (Layout="PARAGRAPH" Wrapping="True"). This of course will not ensure you get a new line exactly where you want it, but will still give you "new lines" where needed.

For having "new lines" exactly where you want them you will probably have to use several TextViews, separated by "<BR>".

If you want to do this in dynamically, in code, I've come up with a relatively simple solution for you:

Put a Panel or PlaceHolder (regular ASP) control where you want to have the text View. In your code do this:

Panel1.Controls.Clear();
Panel1.Controls.Add(new TextView("Line 1"));
Panel1.Controls.Add(new LiteralControl("<br>"));
Panel1.Controls.Add(new TextView("Line 2"));
Panel1.Controls.Add(new LiteralControl("<br>"));
Panel1.Controls.Add(new TextView("Line 3"));

Might not be the best solution, but it will at least have the effect you wanted

Regards,

Ofer

Former Member
0 Kudos

To solve the same problem for Web Dynpro, in the meantime we added support for linebreaks ("\n") to the Unified Rendering, this should provide a solution for HTMLB too.

Armin

Liesbeth
Explorer
0 Kudos

Thanks Ofer for your explanation and the helpful solution!

Regards

Liesbeth

Liesbeth
Explorer
0 Kudos

Hi Armin

I don't understand what you mean! I don't think you can use "\n" in VB.NET?! Could you maybe post an example? Thanks!

Liesbeth

Former Member
0 Kudos

His post was meant more for <b>me</b>...

Don't worry about it

Liesbeth
Explorer
0 Kudos

Ok, I won't ;)! Thanks again for your help!

Greetz

Liesbeth

Former Member
0 Kudos

Have you filled the PDK for .NET survey yet? You can win an MP3 player!!!

http://feedback.sap.com/efs/vote?campaign=39c7899ecca40a6709a638bd0388ac8b&org=332

Answers (0)