Close

Results 1 to 7 of 7
  1. #1
    DF Probation Goldberg's Avatar
    Join Date
    Jun 2001
    Location
    Landaaaan!
    Posts
    14,453
    Thanks
    1,325
    Thanked:        1,547
    Karma Level
    1153

    VB 6 Newbie Help

    Hi all,

    Just learning Visual Basic 6 at Uni and have complied my first program.

    Now my program uses different images depending on the outcome of events in the program. This all works fine on my machine as the pictures are located on my hard drive and I have specified where. However when I have emailed to a firend he is telling me that a Run Time error is occuring as the picture file(s) cannot be found?

    How do I incorporate them into my program so when it is compiled they are actually part of the exe or do I have to send the exe with an additional folder called 'Images' for example? If this is the case then the user would have to ensure that the folder was always in the same place (eg. c:\prog\images\pic1.gif etc...)

    Can anyone help?


    Thanks.
    We all make mistakes sometimes

  2. #2
    DF VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    290

    Default

    you could...

    1. distribute the images files and make sure they occupy the same directory as the VB executable, then you can use the app.path property to locate the pictures

    or

    2. create a resource file with the VS C++ Resource Editor and include that in your file and use the LOADPicture statement to load them. (see this link http://216.26.168.92/vbsquare/beginning/begres/)

  3. #3
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    Isn't the resource editor built into VB or is that just the Enterprise Edition?

  4. #4
    DF Probation Goldberg's Avatar
    Join Date
    Jun 2001
    Location
    Landaaaan!
    Posts
    14,453
    Thanks
    1,325
    Thanked:        1,547
    Karma Level
    1153

    Default

    Yeah I believe it is built in to my Full version. So can you explain to a nooob how to work it?

    Cheers
    We all make mistakes sometimes

  5. #5
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    I don't use VB here at work but if no-one answers you by this evening then I'll tell you. It's very simple.

  6. #6
    DF VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    290

    Default

    1. go into your add-in manager and make sure you have the resource editor loaded and started.
    2. in your project right click on project say add file... then click resource file, name and save resource file
    3. double click on this resource file to open up resource editor
    4. add in any pictures you want.
    5. attach the module attached to this post and include it in your project
    6. to set a picture box to a resource do the following

    Set Picture1.Picture = LoadPictureResource("101", "Custom")

    where first parameter is the resource ID and the second is the resource type.

    thats it really...

  7. #7
    DF Probation Goldberg's Avatar
    Join Date
    Jun 2001
    Location
    Landaaaan!
    Posts
    14,453
    Thanks
    1,325
    Thanked:        1,547
    Karma Level
    1153

    Default

    Excellent, thats what the code looks like i have seen but not understood it.

    Thanks will try that
    We all make mistakes sometimes

Similar Threads

  1. newbie
    By cadfile in forum Introduce Yourself (New Members)
    Replies: 1
    Last Post: 27th July 2006, 02:54 PM
  2. newbie......
    By matthewburton79 in forum Introduce Yourself (New Members)
    Replies: 6
    Last Post: 26th July 2006, 12:24 AM
  3. Hi a newbie again
    By netstaruk in forum Introduce Yourself (New Members)
    Replies: 4
    Last Post: 24th July 2006, 10:02 AM
  4. newbie
    By mem in forum Introduce Yourself (New Members)
    Replies: 3
    Last Post: 23rd July 2006, 02:30 PM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •