First of all, please, read solution #1 by
OriginalGriff[
^]. He's right!
As far as
RichTextBox[
^] has
Lines[
^], an MS Word
document[
^] does not have lines! It has collection of
Paragraphs[
^].
A paragraph can contain text, shapes, images, etc. If you want to get
via Interop clear-text only, you can use below method:
Imports Word = Microsoft.Office.Interop.Word
Dim sFileName As String = "fullfilename"
Dim wdApp As Word.Application = New Word.Application()
Dim wdDoc As Word.Document = wdApp.Documents.Open(sFileName)
Dim lines As String() = wdDoc.Paragraphs.Cast(Of Word.Paragraph) _
.Select(Function(x) x.Range.Text.Trim()).ToArray()
RichTextBox1.Lines = lines
wdDoc.Close(SaveChanges:=False)
wdApp.Quit()
Do not forget to add reference to Microsoft.Office.Interop.Word.dll! How?
c# - How to add reference for "Microsoft.Office.Interop.Word" in .net - Stack Overflow[
^]
For further details, please see:
Documents.Open method (Word) | Microsoft Docs[
^]
Working with Word document content objects - VB.NET code samples[
^]