Results 1 to 4 of 4

Thread: [RESOLVED] How to load an RTF file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2009
    Posts
    31

    Resolved [RESOLVED] How to load an RTF file

    Hi! I would like to show a RTF file in a RichTextBox control. I read there is a loadfile method which requires the path to the RTF file. I would like to deploy this file with my installation, so I suppose I have to insert it as a resource file. But, how can I provide the path to this RTF resource to the method to load the RTF?
    Thanks!

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: How to load an RTF file

    Code:
    'Where "Document" is the file name you added to your resources
    RichTextBox1.Rtf = My.Resources.Document
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  3. #3
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    519

    Re: How to load an RTF file

    Either that, or if you want the application to load an external file you could use the startup path. I use this:
    Public startuppath As String = My.Application.Info.DirectoryPath & "\"

    And then, you'd use:
    RichTextBox1.Rtf = startuppath & "RTF File.rtf"

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2009
    Posts
    31

    Re: How to load an RTF file

    Great! Thank you very much!

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