-
i have two richtextboxes... i want it so that user can only see one of them. I also want the same effect to happen to the invisible one if the user changes the visible one. for example, if user copy and past on the visible one, the invisible one automatically copy and pastes also.. so it should be that whatever happens to visible rtf, same thing happens to the invisible one.. help
one thing i should say, i can't make the text equal... what i mean is that i cannot do r1.text = r2.text... because I'm planning to put html tags on the invisible one as the user inputs.. I know i should do something with keyascii but i can't seem to figure it out
[Edited by xstopx81 on 09-06-2000 at 06:10 PM]
-
Try placing it in the Change() event.
Code:
Private Sub RichTextBox1_Change()
RichTextBox2.TextRTF = RichTextBox1.TextRTF
End Sub
-
sorry megatron... I forgot to say that i can't directly assign the whole text to each other... I must do it by keystrokes... I mean I have to read in the key and give it to the invisible one
-
can anyone help me with my question..? I'm really going nowhere right now... the delete button doesn't even have a keyascii... so far i can only get the characters and return on my invisible one... here's my code
Code:
Private Sub rtfMessage_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
rtfhtml.SelText = vbCrLf
Else
rtfhtml.SelText = Chr(KeyAscii)
End If
End Sub
I'm sure there's an easy way to do this.. help please
-
This code will partly solve your problem.
It requires three richtextboxes. The first is the one to type into. The second the copy and the third is used for the backspace command.
There is three probems with this code.
- You cant copy and paste
- You cant use delete
- If you put in a HTML tag in the second textbox then it will be deleted instead of the charactor.
Code:
Private Sub RText1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 13: RText2.Text = RText2.Text + vbCrLf
Case 8: RText2.SelStart = 0
If Len(RText2.Text) <> 0 Then
RText2.SelLength = Len(RText2.Text) - 1
RText3.Text = RText2.SelText
RText2.Text = RText3.Text
End If
Case Else: RText2.Text = RText2.Text + Chr(KeyAscii)
End Select
End Sub
Instead I would input all of the text into the first box and then add a command button that will go through the text and add the tags in after. A much more efficient way of doing it.