Insert a newline into a string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sdanda
    New Member
    • Oct 2007
    • 36

    Insert a newline into a string

    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.

    [CODE=vbnet]Private Sub help_MouseHover (ByVal sender As Object, ByVal e As System.EventArg s) Handles help.MouseHover
    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")
    End Sub[/CODE]

    I am using \r\n to insert a newline. But it doesn't work. Can you help me?
    Last edited by Killer42; Jan 1 '08, 12:25 PM.
  • VijaySofist
    New Member
    • Jun 2007
    • 107

    #2
    Originally posted by sdanda
    I am using a tooltip control ...
    Hi!

    You can use vbNewLine command.

    Your code can be changed as follows

    [CODE=vbnet]
    Private Sub help_MouseHover (ByVal sender As Object, ByVal e As System.EventArg s) Handles help.MouseHover
    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")
    End Sub[/CODE]

    All the best.

    With Regards
    Vijay. R
    Last edited by Killer42; Jan 1 '08, 12:27 PM.

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      You can also use chr(10) , chr(13) or combination of both for the purpose.

      Comment

      • CyberSoftHari
        Recognized Expert Contributor
        • Sep 2007
        • 488

        #4
        One more point, You can use
        [CODE=vb]vbCr[/CODE]

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          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. :)

          Comment

          • QVeen72
            Recognized Expert Top Contributor
            • Oct 2006
            • 1445

            #6
            Hi,

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

            Add a ToolTip Control to your form, and ..


            Me.ToolTipProvi derCtl.SetToolT ip(Me.Button1, "this is" _
            & environment.New Line & _
            "a multiline" & environment.New Line & "tooltip!")


            REgards
            Veena

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Thanks for that, Veena.

              It's good to know MS did fix some of the annoying bits. :)

              Comment

              Working...