469,271 Members | 1,110 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Multiline tooltip problem... shows the \n's


Hi all -
Read here that embedding \n's into the tooltip string during runtime should
yeild multiline tooltips. However, mine is just keeping the \n's in there
and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );

Jan 21 '07 #1
9 23751
use this, \r\n:

string slabelinfo = "line1\r\n line2";
toolTip1.SetToolTip(slabel1, slabelinfo );

"Alex" <me******@test.comwrote in message
news:Xn****************************@199.45.49.11.. .
>
Hi all -
Read here that embedding \n's into the tooltip string during runtime
should
yeild multiline tooltips. However, mine is just keeping the \n's in there
and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );

Jan 21 '07 #2
On Sun, 21 Jan 2007 18:40:43 +0100, Alex <me******@test.comwrote:
>
Hi all -
Read here that embedding \n's into the tooltip string during runtime
should
yeild multiline tooltips. However, mine is just keeping the \n's in
there
and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );
Hi

Try also adding a carriage return character \r since the windows way is
really a combination of cr and lf (lf is just for *nix machines)

--
- Stefan Z Camilleri
- www.szc001.com
Jan 21 '07 #3

I changed the \n to \n\r, but it still shows the \n\r in the same single
line.

"Stefan Z Camilleri" <sz****@szc001.comwrote in
news:op***************@asusw2jc.lan:
On Sun, 21 Jan 2007 18:40:43 +0100, Alex <me******@test.comwrote:
>>
Hi all -
Read here that embedding \n's into the tooltip string during runtime
>should
yeild multiline tooltips. However, mine is just keeping the \n's in
>there
and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );

Hi

Try also adding a carriage return character \r since the windows way is
really a combination of cr and lf (lf is just for *nix machines)
Jan 21 '07 #4
i said \r\n not \n\r
"Alex" <me******@test.comwrote in message
news:Xn*****************************@199.45.49.11. ..
>
I changed the \n to \n\r, but it still shows the \n\r in the same single
line.

"Stefan Z Camilleri" <sz****@szc001.comwrote in
news:op***************@asusw2jc.lan:
>On Sun, 21 Jan 2007 18:40:43 +0100, Alex <me******@test.comwrote:
>>>
Hi all -
Read here that embedding \n's into the tooltip string during runtime
>>should
yeild multiline tooltips. However, mine is just keeping the \n's in
>>there
and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );

Hi

Try also adding a carriage return character \r since the windows way is
really a combination of cr and lf (lf is just for *nix machines)

Jan 21 '07 #5
On Sun, 21 Jan 2007 17:40:43 GMT, Alex <me******@test.comwrote:
>
Hi all -
Read here that embedding \n's into the tooltip string during runtime should
yeild multiline tooltips. However, mine is just keeping the \n's in there
and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );
You may find that Environment.NewLine works better.

rossum

Jan 21 '07 #6
On Sun, 21 Jan 2007 19:36:53 +0100, Alex <me******@test.comwrote:
>
I changed the \n to \n\r, but it still shows the \n\r in the same single
line.

"Stefan Z Camilleri" <sz****@szc001.comwrote in
news:op***************@asusw2jc.lan:
>On Sun, 21 Jan 2007 18:40:43 +0100, Alex <me******@test.comwrote:
>>>
Hi all -
Read here that embedding \n's into the tooltip string during runtime
>>should
yeild multiline tooltips. However, mine is just keeping the \n's in
>>there
and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );

Hi

Try also adding a carriage return character \r since the windows way is
really a combination of cr and lf (lf is just for *nix machines)
Try inverting them, \r\n

--
- Stefan Z Camilleri
- www.szc001.com
Jan 21 '07 #7

Tried the \r\n, but it stayed on one line. Switched the stored proc that
generates the string back to using \n and did a string.replace of \\n with
Environment.Newline and it replaced the \n with \r\n, but does give a
multiline tooltip.

Don't understand what the diff would be, but it works!

Thanks :)

rossum <ro******@coldmail.comwrote in
news:1o********************************@4ax.com:
On Sun, 21 Jan 2007 17:40:43 GMT, Alex <me******@test.comwrote:
>>
Hi all -
Read here that embedding \n's into the tooltip string during runtime
should yeild multiline tooltips. However, mine is just keeping the
\n's in there and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );

You may find that Environment.NewLine works better.

rossum

Jan 21 '07 #8
Tried the \r\n, but it stayed on one line. Switched the stored proc that
generates the string back to using \n and did a string.replace of \\n with
Environment.Newline and it replaced the \n with \r\n, but does give a
multiline tooltip.

Don't understand what the diff would be, but it works!
If a stored procedure generated a "\n" it would be a string of two
characters: '\' and 'n'.
If you use this inside a string literal in a C# program (string s =
"1\n2"), then the *real* string would be 3 characters, with the middle
one being a character with code 10. (Note that the debugger, trying to
be helpful, still will display the "\n").

So the "\n" from the stored procedure is just that, while a "\n" inside
C# is an escape-code for the newline character.
Hans Kesting
Jan 22 '07 #9
Good to know - thx for the explanation!

I was thinking the tooltip display would parse the string for \n's, but now
I understand what's going on. Just needed the extra step of replacing the
\n's with newlines in the string then.

Hans Kesting <ne***********@spamgourmet.comwrote in
news:mn***********************@spamgourmet.com:
>Tried the \r\n, but it stayed on one line. Switched the stored proc
that generates the string back to using \n and did a string.replace
of \\n with Environment.Newline and it replaced the \n with \r\n, but
does give a multiline tooltip.

Don't understand what the diff would be, but it works!

If a stored procedure generated a "\n" it would be a string of two
characters: '\' and 'n'.
If you use this inside a string literal in a C# program (string s =
"1\n2"), then the *real* string would be 3 characters, with the middle
one being a character with code 10. (Note that the debugger, trying to
be helpful, still will display the "\n").

So the "\n" from the stored procedure is just that, while a "\n"
inside C# is an escape-code for the newline character.
Hans Kesting
Jan 22 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by kiran | last post: by
2 posts views Thread by Alexander Bolotnov | last post: by
4 posts views Thread by Saber S | last post: by
reply views Thread by Tan Nguyen | last post: by
1 post views Thread by Mitchell Vincent | last post: by
4 posts views Thread by Tim Zych | last post: by
5 posts views Thread by =?Utf-8?B?cGV0ZTE5Njk=?= | last post: by
3 posts views Thread by Rainer Queck | last post: by
omerbutt
3 posts views Thread by omerbutt | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.