has been very confused, how to merge two RTF files, use the common method of merging, the merged file is very large, and the content is only the first file, I think it is due to the end of the file, even with the copy function, the resulting merged file, although a little, However, the displayed content is the same as the file that is merged in the code. Because files are mixed in text, merging a string is not feasible, and then always looking for methods.
The best way to find this is to read RTF into RichTextBox, a display object, an object created during the run, an object created during the run that only needs loadfile, then select All, then use SELECTEDRTF, It is not troublesome to paste on the displayed object after the copy, but I always think it is not the best way, but at present there is no good way, who let me have no idea about file operation. Difficult and difficult.
Copy and paste the following code:
Public Shared Function Rtffilemerge (ByVal firstfile As String, ByVal Secondfile as String) as Boolean
Dim Rtb1 as New RichTextBox
Dim RTB2 as New RichTextBox
Dim Rflag as Boolean = False
Try
Rtb1. LoadFile (Firstfile)
Rtb2. LoadFile (Secondfile)
Rtb2. SelectAll ()
Rtb2. Copy ()
Rtb1. AppendText (CHR (13))
Rtb1. Paste ()
Rtb1. SaveFile (Firstfile)
Rtb2. Dispose ()
Rtb1. Dispose ()
Rflag = True
Catch ex as Exception
MessageBox.Show (ex. Message)
End Try
Return Rflag
End Function