473,486 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 24233
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
1610
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
4746
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
3314
by: Saber S | last post by:
How can I make a multi line tooltip when I point to a button?
0
901
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
1337
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
1515
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
9793
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
4654
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
2574
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
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.