dcsimg
Results 1 to 11 of 11

Thread: invalid file reference.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    invalid file reference.

    Hello

    Can you guys tell me how to find out which picturebox does a picture refer to.

    in this existing project, i removed these pictures and i ended up with this error line in a log file.

    Line 8: Property Icon in cars had an invalid file reference.

    i looked in the cars.frm and could not see property icon on line 8

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: invalid file reference.

    basically whats happened is you've opened the project yet the cars.frx file was missing. VB then removes the control which relied on the .frx file (these are controls that have any images in basically) most the time it replaces the control with a empty picturebox though.

    When you add a image to your project, by putting it in a Picture/Icon property VB saves the picture in the .frx file for that form. This is so if the image file changes or is lost it doesn't effect your project. But as you see if you loss the .frx file it can't find the image anymore .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: invalid file reference.

    thanks for the reply, i have been looking for that picture high and low

    i guess the .frx contains all the pictures that go with that form, correct?

    does it contain anything else?

    so if i create say a new pic box, and point that piture box to a new picture, would that picture get stored and the .frm is updated, so thateven if i remove the picture i am pointing to, everything will be ok?

    what did it mean by the line reference?

  4. #4
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: invalid file reference.

    Quote Originally Posted by vb_student
    thanks for the reply, i have been looking for that picture high and low

    i guess the .frx contains all the pictures that go with that form, correct?

    does it contain anything else?

    so if i create say a new pic box, and point that piture box to a new picture, would that picture get stored and the .frm is updated, so thateven if i remove the picture i am pointing to, everything will be ok?

    what did it mean by the line reference?
    As far as I can remember yea its just images, but basically its a big chunk of data, and in the .frm file it contains a line referance which tells the compiler where abouts in the .frx file that pictureboxes image is. Think of the .frx file and a load of chunks of data head to tail which no dividers, the only way to know where the pictures are is the .frm's referance. Thats why you get that error message, because the file doesn't exist (or rather it recreated a blank one in memory and the line referance is invalid for the new blank one .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  5. #5
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: invalid file reference.

    In addition to picture references, the .frx file contains references for controls that have been added to your project. If you add, say a ListView, and save the project, and then move the .frx file to another folder, when you reopen the project, you will get a message indicating that it couldn't load the .OCX file that contains the listview control and the control itself would show up as a blank spot on your form.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: invalid file reference.

    is the line reference present in the .frm file

    i cant find it!

  7. #7
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: invalid file reference.

    Quote Originally Posted by vb_student
    is the line reference present in the .frm file

    i cant find it!
    No, it will be embedded in the .frx file which is a binary file.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  8. #8
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: invalid file reference.

    Quote Originally Posted by vb_student
    is the line reference present in the .frm file

    i cant find it!
    If you make a simple project, just a form with a picture box on it and a image in the picturebox. Then save it and open the .frm file in Notepad or simplar and you'll find:
    Code:
       Begin VB.PictureBox picIcon 
          AutoSize        =   -1  'True
          ClipControls    =   0   'False
          Height          =   540
          Left            =   240
          Picture         =   "frmAbout.frx":058A
          ScaleHeight     =   337.12
          ScaleMode       =   0  'User
          ScaleWidth      =   337.12
          TabIndex        =   1
          Top             =   240
          Width           =   540
       End
    This was taken from a form of mine which had other things on, notice the picture property says the name of the .frx file and gives a location in the file (the line referance). I had an Icon property set further up thats why its not "frmAbout.frx":0000 but it did have that for the first one.

    Also just a little extra, all images when you put them in a VB project get converted to 24bit bmp's. So knowing this the compiler will know how long the block of memory is in the .frx file that belongs to this control. However that bit was me guessing as it could actually hold that info at that location in the .frx file.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: invalid file reference.

    thanks for clearing it all up

    so the line the log file was mentioning was actually in the .frm file, only i had to open it in notepad.

    what happens if i delete the .frm file and then point the picture box to a new picture, does it create a new .frx file with the right picture in it. or is the creation of the .frx file triggered by some other event, like compiling all the .frm files into an executable??

  10. #10
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: invalid file reference.

    It'll create the .frx file next time you save the project (or save just the form too).
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: invalid file reference.

    thanks

    makes sense

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width