General discussion

  • Creator
    Topic
  • #2187637

    VB6 ToolTipText

    Locked

    by stokecity ·

    How do I produce a “wrap round” in the text input
    for the ToolTipText property. Would like to produce a “box” of text not one complete line of text.

All Comments

  • Author
    Replies
    • #3257183

      Reply To: VB6 ToolTipText

      by tknilans ·

      In reply to VB6 ToolTipText

      You may want to try the carriage return vbCr preceeded and followed by ampersand. I’ve never tried using in this context, but it may work. An example would be:

      object.TooltipText = “This is the first line ” & vbCr & “and this is the second line.”

      • #3243054

        Reply To: VB6 ToolTipText

        by stokecity ·

        In reply to Reply To: VB6 ToolTipText

        object.TooltipText = “This is the first line ” & vbCr & “and this is the second line.” gives “This is the first line ” & vbCr & “and this is the second line.” as a display.

    • #3339079

      Reply To: VB6 ToolTipText

      by harun ·

      In reply to VB6 ToolTipText

      This is a simple code to wrap a long string into seperate lines without spliting in the middle of a word.

      You will need 1 command button and 3 textboxes to test the code.

      Dim Found As Integer

      If Len(Text1.Text) < 21 Then Text2.Text = Text1.Text Else Found = InStrRev(Text1.Text, " ", 20) Text2.Text = Mid(Text1.Text, 1, Val(Found)) Text3.Text = Mid(Text1.Text, Val(Found) + 1) End If

      • #3339077

        Reply To: VB6 ToolTipText

        by harun ·

        In reply to Reply To: VB6 ToolTipText

        Or
        The code allows the programmer to define the number of characters each line will display and then inserts a Chr(13). Take a look it could be useful
        ‘———————————————
        ‘Me.txtMsg is the text box to print.
        ‘TempMsg is the string that I build the printable message
        ‘SelStart is the SelStart property of the text box – assigning it directly did not work
        ’75 is the number of characters that I needed on a line.

        Dim TempMsg As String
        Dim SelectLength, SelectStart, Trapper As Integer
        If Len(Me.txtMsg.Text) < 75 Then TempMsg = Me.txtMsg.Text Else SelectStart = 0 SelectLength = 75 Do While Len(Me.txtMsg.Text) > 0
        Clipboard.Clear
        If Len(Me.txtMsg.Text) < 75 Then Me.txtMsg.SelLength = Len(Me.txtMsg.Text) Else Me.txtMsg.SelLength = 75 End If Trapper = InStrRev(Me.txtMsg.SelText, Chr(32), -1, vbBinaryCompare) If Trapper = 0 Then Me.txtMsg.SelLength = Len(Me.txtMsg.Text) Else Me.txtMsg.SelLength = Trapper End If TempMsg = TempMsg & Me.txtMsg.SelText & Chr(13) MsgBox TempMsg Me.txtMsg.SelText = "" Me.txtMsg.SelStart = 0 Loop End If

Viewing 1 reply thread