Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RichTextBox 1

Status
Not open for further replies.

fancom

Programmer
Feb 7, 2001
46
TR
Hi. I want to make an app which has a richtextbox. But when richtextbox multiline is true and scroll bars are set to both open, the horizantal scroll bar doesn't seem.

They said I've to close the wordwrap but ;

when I type ;

richtextbox1.wORDWrap = false

vb makes it

RichTextBox1.WordWrap = false

so vb knows the method 'wordwrap'

but when I run the program ;

vb says "data member or method not found"

what must I do ?
 
>so vb knows the method 'wordwrap'

Indeed. But not for a RichTextBox

Try tapping in the following code to get an idea of what is happening:
Code:
[blue]    Dim SillyExample As String
    
    RichTextBox.sILLyexAMPle = "See what I mean?"[/blue]

 
thank you strongm, I understood why vb knows it. However my problem continues. How can I use multiline with both scrollbars at once ?

P.S. I did not declared any variable like 'wordwrap'. I think other components I used have this method so, vb knows it...
 
>I did not declared any variable like 'wordwrap'.

I didn't think you did. I was just providing the shortest illustration of the issue that I could.

As for how to get the horizontal scrollbar to appear, I'm always optimistic that people read help files. The VB helpfile entry for the Scrollbars property says:
VB6 Helpfile said:
A horizontal scrollbar will appear only when the RightMargin property is set to a value that is larger than the width of the control. (The value can also be equal to, or slightly smaller than the width of the control.)

 
Hey I've forgotten to say I am very newbie to vb. And I feel that I've been skilled a little bit more with the information. I thank you very much, and I warn you to prepare yourself with my tones of silly questions :D...
 
Study this.

add the richtextbox and a checkbox to a form and paste the code below

Code:
'be sure to set the richtextbox scrollbars property to 3-rtfboth
Private 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
Private Const WM_USER = &H400
Private Const EM_SETTARGETDEVICE = (WM_USER + 72)

Private Sub Check1_Click()

If Check1.Value = 1 Then
    SendMessageLong RichTextBox1.hWnd, EM_SETTARGETDEVICE, 0, 0 'wrap
ElseIf Check1.Value = 0 Then
    SendMessageLong RichTextBox1.hWnd, EM_SETTARGETDEVICE, 0, 1 'no word wrap
End If

End Sub

Private Sub Form_Load()
    Check1.Caption = "WordWrap"
    Check1.Value = 1
    RichTextBox1.AutoVerbMenu = True
    RichTextBox1.Text = "SendMessageLong RichTextBox1.hWnd, EM_SETTARGETDEVICE, 0, 0 'wrap"
End Sub
 
I am going to give you a star, thank you.
 
And all that API code does is the same as setting the RTB's Multiline property (with the one difference that you can make the change at run time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top