hi, I have a RichTextBox with buttons two check boxes add and replace. the problem is when i open a file it should open it exactly where the mouse cursor is and replace the text that is selected in the richtextbox (if there is any ).

And the second part would be to with the save button. If add is selected then it should add the content to the file or it should replace the content if replace is selected.

i have an open dialog and it's a txt file.
I am using the following code to open the file.

Code:
Private Sub Command1_Click()
On Error GoTo Cancel
CommonDialog1.DefaultExt = "txt"
CommonDialog1.ShowSave
Cancel:
End Sub



thanks a lot for the help given