|
-
Aug 16th, 2007, 07:39 PM
#1
Thread Starter
New Member
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
-
Aug 16th, 2007, 07:49 PM
#2
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.
Last edited by VBDT; Aug 16th, 2007 at 09:29 PM.
-
Aug 16th, 2007, 09:11 PM
#3
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)
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|