TIA
Pete
Set it to something WAY high...
D.
"Pete Sackett" <psac...@nospam.fuse.net> wrote in message
news:u3ZSlsHnCHA.2224@TK2MSFTNGP11...
Set the RichTextBox1.RightMargin = n <<n in Twips>>
where the "n" means pick some number that will be larger than the number
of Twips for the longest amount of text you expect on a single line. For
example, try setting the RightMargin to 30000 to get an idea of how this
will work. Note that word wrapping will occur when the width of the text
exceeds the RightMargin.
Rick - MVP
You can mess with the margins as suggested, or use this simple API call:
Add the following to a Module:
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA"
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal LParam
As Long) As Long
Public Const WM_USER = &H400
Public Const EM_SETTARGETDEVICE = (WM_USER + 72)
Public Sub SetWordWrap(ByRef pctl As Control, ByVal pbWordWrap As Boolean)
If pbWordWrap Then
SendMessageLong pctl.hWnd, EM_SETTARGETDEVICE, 0, 0
Else
SendMessageLong pctl.hWnd, EM_SETTARGETDEVICE, 0, 1
End If
End Sub
Usage:
' Turn Word Wrap On
Call SetWordWrap(RichTextBox1, True)
' Turn Word Wrap Off
Call SetWordWrap(RichTextBox1, False)
Gordon Bell
"Pete Sackett" <psac...@nospam.fuse.net> wrote in message
news:u3ZSlsHnCHA.2224@TK2MSFTNGP11...
D.
"Gordon Bell" <gsb...@hotmail.com> wrote in message
news:u$2rtdInCHA.1612@TK2MSFTNGP10...
Pete
"Pete Sackett" <psac...@nospam.fuse.net> wrote in message
news:u3ZSlsHnCHA.2224@TK2MSFTNGP11...
Thanks for the tip, it works well.
I am wondering how you discovered this solution - the MSDN library and MS
website contain no information on SendMessageLong, much less the constants /
values to be passed by it to accomplish the desired effect.
Thanks,
Pete
"Gordon Bell" <gsb...@hotmail.com> wrote in message
news:u$2rtdInCHA.1612@TK2MSFTNGP10...
>