By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,057 Members | 1,346 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,057 IT Pros & Developers. It's quick & easy.

Insert a newline into a string

P: 36
I am using a tooltip control for a picturebox control. I would like to display the caption of the tooltip in newline. How to do this?
My picturebox name is help and tooltip name is ttp and I am displaying this tooltip on the mousehover event of the pictureimage.

Expand|Select|Wrap|Line Numbers
  1. Private Sub help_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles help.MouseHover
  2.     tt1.SetToolTip(help, "You can select one of the two setup dialog box.The Setup type dialog boxes views are represented below \r\n Based on the selection of this setup type, The installscript project displays corresponding setup type type during the installation of your application")
  3. End Sub
I am using \r\n to insert a newline. But it doesn't work. Can you help me?
Dec 31 '07 #1
Share this Question
Share on Google+
6 Replies


VijaySofist
100+
P: 107
I am using a tooltip control ...
Hi!

You can use vbNewLine command.

Your code can be changed as follows

Expand|Select|Wrap|Line Numbers
  1. Private Sub help_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles help.MouseHover
  2.     tt1.SetToolTip(help, "You can select one of the two setup dialog box.The Setup type dialog boxes views are represented below" & vbNewLine & " Based on the selection of this setup type, The installscript project displays corresponding setup type type during the installation of your application")
  3. End Sub
All the best.

With Regards
Vijay. R
Dec 31 '07 #2

debasisdas
Expert 5K+
P: 8,127
You can also use chr(10) , chr(13) or combination of both for the purpose.
Dec 31 '07 #3

Expert 100+
P: 487
One more point, You can use
Expand|Select|Wrap|Line Numbers
  1. vbCr
Dec 31 '07 #4

Expert 5K+
P: 8,434
One thing to keep in mind. Based on other posts here, I believe that in VB6, ToolTipText cannot include line breaks. Um... as far as I can recall, they are simply ignored. It may be that this is still the case in your version.

Or they may have improved matters, of course - don't give up too easily. :)
Jan 1 '08 #5

QVeen72
Expert 100+
P: 1,445
Hi,

Yes Killer, VB.net has Improved, and ToolTip Control can have new Lines..

Add a ToolTip Control to your form, and ..


Me.ToolTipProviderCtl.SetToolTip(Me.Button1, "this is" _
& environment.NewLine & _
"a multiline" & environment.NewLine & "tooltip!")


REgards
Veena
Jan 1 '08 #6

Expert 5K+
P: 8,434
Thanks for that, Veena.

It's good to know MS did fix some of the annoying bits. :)
Jan 1 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.