Results 1 to 7 of 7

Thread: App.Path [RESOLVED!]

  1. #1

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253

    App.Path [RESOLVED!]

    Ive got a listbox, so when i click on a certain item, i want to open a text file into my textbox. The text files are in a extra folder called Tutorials. Here is what ive been trying to use to open the file:

    VB Code:
    1. Open App.Path & "\Tutorials\Common Dialog.txt" For Binary As #1
    2. Dim scriptText As String: scriptText = Space(LOF(fnum))
    3. Get #1, , scriptText
    4. txtCode.Text = scriptText
    5. Close #fnum

    But that doesnt work. I even tried changing For Binary to Input. But it doenst load anything. Any ideas?

    THANKS!
    Last edited by Madboy; Nov 2nd, 2003 at 01:23 PM.

  2. #2
    i wouldnt use binary for a text file, try this:

    VB Code:
    1. dim ffile as Integer
    2. dim strData as String
    3. ffile = FreeFile
    4.  
    5. Open App.Path & "\Tutorials\Common Dialog.txt" For Input As #ffile
    6. Do until eof(#ffile)
    7. Line Input #ffile, strData
    8. txtCode.Text = txtCode.text & strData & vbcrlf
    9. DoEvents
    10. Loop
    11. Close #ffile
    a 17 year old kid who has nothing better to do !
    and i never said i was right !!!

  3. #3

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    Thanks, but it attempts to load the file but doesnt. The scrollbars go funny and my app locks up

  4. #4

  5. #5
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    open App.Path & "\Tutorials\Common Dialog.txt" For Input as #1
    Dim scriptText As String
    scriptText = input$(lof(1),1)
    close #1

    txtCode.txt=scripttext

  6. #6

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    It doesnt do anything buggy programmer. Have i got the App.Path code right?

    And i was using this code marty:

    VB Code:
    1. Open App.Path & "\Tutorials\Common Dialog.txt" For Binary As #1
    2. Dim scriptText As String: scriptText = Space(LOF(fnum))
    3. Get #1, , scriptText
    4. txtCode.Text = scriptText
    5. Close #fnum

  7. #7

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    Silly me. I have a seperate folder called My Programs, i put the tutorials in there, instead of in my Projects folder. It works great now.

    THANKS!

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