Tempest3D
April 30th, 2001, 08:21 PM
I currently have the following code
private Sub Command1_Click()
RichTextBox1.Text = RichTextBox1.Text & vbNewLine & Text1.Text
RichTextBox1.SelStart = InStr(len(RichTextBox1.Text) - len(Text1.Text), RichTextBox1.Text, Text1.Text) - 1
RichTextBox1.SelLength = len(Text1.Text)
If Option1.Value = true then
RichTextBox1.SelColor = vbRed
else
RichTextBox1.SelColor = vbBlue
End If
RichTextBox1.SelLength = 0
End Sub
(where option1 says red and option2 says blue)
(the way it works is you type text in Text1, and it adds that to RichText1, in the selected color)
Eveytime I click command1, the whole textbox resets itself to black, and only the last thing i typed in has any color. What do I need to do?
private Sub Command1_Click()
RichTextBox1.Text = RichTextBox1.Text & vbNewLine & Text1.Text
RichTextBox1.SelStart = InStr(len(RichTextBox1.Text) - len(Text1.Text), RichTextBox1.Text, Text1.Text) - 1
RichTextBox1.SelLength = len(Text1.Text)
If Option1.Value = true then
RichTextBox1.SelColor = vbRed
else
RichTextBox1.SelColor = vbBlue
End If
RichTextBox1.SelLength = 0
End Sub
(where option1 says red and option2 says blue)
(the way it works is you type text in Text1, and it adds that to RichText1, in the selected color)
Eveytime I click command1, the whole textbox resets itself to black, and only the last thing i typed in has any color. What do I need to do?