Results 1 to 3 of 3

Thread: Problem with opening MS Word Files in a treeview - vb.net

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    2

    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

  2. #2
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    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.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width