
mdi child form with rtb & scrollbars problem
Arnie:
I don't know which version of the rtb you have. The current version is 6
(service pack 4). I put this code in an MDI child form and tried it. Even
with re-sizing the width of the child window, and thus resizing the rtb, the
text remained fine. All I did was change the ScrollBars property to
rtfVertical. Otherwise, the control uses all of the defaults.
I made the child form and control as follows:
Form1.Height = 4110
Form1.Width = 2895
RichTextBox1.Height = 2655
RichTextBox1.Width = 2535
RichTextBox1.Left = 120
RichTextBox1.Top = 240
And put Command1 below the rtb. The above settings were put in the
properties window, not set programmatically. And then the code:
Private Sub Command1_Click()
txtSample = ""
For LoopVar = 1 To 10
txtSample = txtSample & "This is some longer text to see if it cuts
off properly and see if it breaks words that are too long like
supercalifragilisticexpialidocious and
supercalifragilisticexpialidocioussupercalifragilisticexpialidocioussupercal
ifragilisticexpialidocious and if it works with the vertical scroll bar as
it should. "
Next LoopVar
RichTextBox1.Text = txtSample
End Sub
Private Sub Form_Resize()
RichTextBox1.Width = Form1.Width - 360
End Sub
If this doesn't work then you should check your version (previous ones
had bugs) or, specify what is done differently than I did.
Doug
Quote:
> I have an MDI Child with a rich text box. I can't get the text to stop at
> the righ hand edge of the rtb. I have set the property to Multiline, I
have
> tried all combinations of Scroll bar but nothing works.
> Any ideas anyone ??
> --
> Arnie Owen
> remove the obvious to reply