VB6 ToolTipText
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.
Web Development
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.
by tknilans
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."
by stokecity
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.
by harun
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
by harun
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
This discussion is closed to new replies.
Sort by Trending