Results 1 to 10 of 10

Thread: Strange Error

  1. #1

    Thread Starter
    Hyperactive Member CHAMPGARY's Avatar
    Join Date
    Jul 2002
    Posts
    386

    Strange Error

    Hi,

    I burnt my application on CD with necessary sound and image files. Which is not running from CD ROM, but if the same application, I copy down to my Hard Disk , it runs perfectly,
    While running from CD ROM it gives me run time error "path not found" for images, though the error specified images are present on right path, and I have use app.path correctly....

    I am just fade up ...
    Please help me ASAP

    Regards

    Gary

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Did you make sure and include a backslash ("\") after app.path?
    Something like this:

    VB Code:
    1. MyPath = App.Path & "\Img\Img1.bmp"
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by RealisticGraphics
    Did you make sure and include a backslash ("\") after app.path?
    It wouldn't matter since it works on his computer.
    Last edited by The Hobo; Aug 3rd, 2002 at 01:54 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    To complete the idea....

    If you run this code from a CD (let's say the D: drive)
    VB Code:
    1. App.Path & "\Img\Img1.bmp"
    you will get "D:\\Img\Img1.bmp"
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  5. #5
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    So, you should use something like:
    VB Code:
    1. Public Function AppPath () As String
    2.    AppPath = App.Path & Iif(Right(App.Path, 1) = "\", "", "\")
    3. End Function
    Usage:
    VB Code:
    1. AppPath & "Img\Img1.bmp"
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: To complete the idea....

    Originally posted by Mc Brain
    If you run this code from a CD (let's say the D: drive)
    VB Code:
    1. App.Path & "\Img\Img1.bmp"
    you will get "D:\\Img\Img1.bmp"
    Why does it do it like that with a CD Drive but not a fixed drive?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    What do you mean? It does the same... save your project in the root of your harddrive and you'll see it's exactly the same.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  8. #8
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    VB Code:
    1. Private Sub Form_Load()
    2.   MsgBox App.Path
    3. End Sub

    Gives me "C:\Program Files\Microsoft Visual Studio\VB98"

    I saved the project too, even compiled it and ran it. That's what I got.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  9. #9
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Wait, root of my hard dive. Yeah, it gives "C:\"

    but if it's every any folder it doesn't give "\"

    I see what you mean now. Okay
    My evil laugh has a squeak in it.

    kristopherwilson.com

  10. #10
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    HOBO: Good point. I missed the fact that it was working on his computer.

    Mc Brain: Interesting. I didn't realize it would do that on the root drive. Anyway, to get around the problem I always use the following function... Similar to yours but works with any directory I pass.

    VB Code:
    1. Public Function CheckDir(ByVal Expression As String, Optional ByVal RemoveDir As Boolean = False) As String
    2. If Len(Expression) <> 0 Then
    3.     If RemoveDir = False Then
    4.         CheckDir = IIf(Right(Expression, 1) = "\", Expression, Expression & "\")
    5.     Else
    6.         CheckDir = IIf(Right(Expression, 1) = "\", Left(Expression, Len(Expression) - 1), Expression)
    7.     End If
    8. End If
    9. End Function
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

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