Results 1 to 7 of 7

Thread: Loading a textfile *[RESOLVED]*

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    31

    Question Loading a textfile *[RESOLVED]*

    I wish to load a textfile into a richtextbox, but i'm not sure how to get the relevant path.

    The textfile is situated in a 'data' folder where the program is situated. In VB6, you could have:

    VB Code:
    1. rtbAbout.FileName = App.Path & "\data\about.rtf"
    but there's no app.path in VB .NET, how would I get the relevant path to the textfile?

    Thanks
    Last edited by NickyDude; Dec 6th, 2002 at 10:20 AM.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    Application.StartupPath

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    31
    Thanks!!

    [newbie, me?]


  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    just put "\data\file.txt" i think
    \m/\m/

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    define the path and then call the method like this
    VB Code:
    1. Imports System.Reflection
    2.  
    3. dim the_path as string =system.Windows.Forms.Application.StartupPath
    4.  
    5.  
    6. RichTextBox1.LoadFile(the_path,richTextBoxStreamType.PlainText)

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    better you check out this link :
    http://pub52.ezboard.com/finteractiv...opicID=2.topic
    Luck

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    31
    Thanks guys!

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