473,237 Members | 1,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

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 24205
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kiran | last post by:
I set a tooltip to a button. using SetToolTip method.in Form_Load function. When I mouse over the button tooltip is comming perfectly. But When I click the button and mouse over the button ,...
2
by: Alexander Bolotnov | last post by:
Good day to everyone, I am trying to make a ToolTip for a couple of TextBoxes. What I do is: create a new ToolTip and make it a Balloon: ToolTip myToolTip = new ToolTip();...
4
by: Saber S | last post by:
How can I make a multi line tooltip when I point to a button?
0
by: Tan Nguyen | last post by:
Hello, I have a problem using tooltip. The application that I'm creating uses specially created ActiveX controls in an MDI Child form. I have the following code in the form that's the MDI...
1
by: Mitchell Vincent | last post by:
Using VB.NET 2003, I have a tooltip control on an MDI child window's control. When I hover over it when the application is running the tooltip appears behind the parent window (I can only tell...
4
by: Tim Zych | last post by:
I'm displaying a tooltip related to a listbox based on the selected item. It works well except when I move the cursor away from the listbox and then hover back over it, the tooltip pops up...
5
by: =?Utf-8?B?cGV0ZTE5Njk=?= | last post by:
I use Visual Studio 2005 and created a very simple Form with one button. I added a Tooltip for that button. It shows fine the first time I hover over that button. But if I let it disappear by the...
3
by: Rainer Queck | last post by:
Hi NG, working on a project in VS2005 I started to add ToolTips. My problem now is, that each ToolTip only shows once. mouving the mouse over a button shows its tooltip, moving to the next...
3
omerbutt
by: omerbutt | last post by:
hi there i have downloaded a prototype tooltip from http://www.nickstakenburg.com/projects/prototip/ the logic it uses is to call the script after creating the <div> for example i am using the...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.