I saw a similar question on How can I read multiple text files and store them in a TextBox? , but it didn't really help with what I'm trying to do. I'm trying to load multiple Rich Text Files into 1 Rich Text Box, is that possible? My current code is this:
Private Sub LoadButton_Click(sender As Object, e As EventArgs) Handles LoadButton.Click
Dim openFile1 As New OpenFileDialog()
openFile1.DefaultExt = "*.rtf"
openFile1.Filter = "RTF Files|*.rtf"
Dim openFile2 As New OpenFileDialog()
openFile2.DefaultExt = "*.rtf"
openFile2.Filter = "RTF Files|*.rtf"
If (openFile1.ShowDialog() = System.Windows.Forms.DialogResult.OK) And
(openFile2.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then
RichTextBox1.LoadFile(openFile1.FileName, openFile2.FileName)
End If
End Sub
It has no problem loading one file to the text box, but if I try to add the second file with the first, it crashes.
The current error that I get is "Conversion from string "C:\Software Development\Test\ann" to type 'Integer' is not valid."
C:\Software Development\Test\ann is the openFile2.FileName