Problem with opening MS Word Files in a treeview - vb.net
Hello all and thanks in advance, I 've got the following code to open .txt document in a treeview with no problem, but I need use MS word document instead of txt document, could you tell me how I can do it. Please note I’m using VB.net 2003.
Here is the part of the program related to my question:
Private Sub Abrir()
Dim s As string
Dim fs As New FileStream(Application.StartupPath & "\" & s & _
".txt", FileMode.Open, FileAccess.Read)
Dim m_streamReader As New StreamReader(fs)
m_streamReader.BaseStream.Seek(0, SeekOrigin.Begin)
Me.TxtCodigo.Text = ""
Dim strLine As String = m_streamReader.ReadLine()
While Not (strLine Is Nothing)
Me.TxtCodigo.Text += strLine + ControlChars.Lf
strLine = m_streamReader.ReadLine()
End While
m_streamReader.Close()
End Sub
Thank you for reading
Re: Problem with opening MS Word Files in a treeview - vb.net
Welcom to VBForums:)
What do you want to achieve? Open the MS document with MS Word app? Or read the file content? And what you mean by Open in TreeView?
If you want to read the content than be aware that MS document has other format than the regular text so it might not appear 100% readable text.
Re: Problem with opening MS Word Files in a treeview - vb.net
Whatever you plan on doing with it Im unsure but to open a word document and read its content you will want to go over my Office Dev. FAQs on it. (link in signature)