We help IT Professionals succeed at work.

vb6 href 'invalid property assignment'

jmkexp
jmkexp asked
on
I localize a file to my drive then try to change the html to point to it and get "invalid property assignments". The file saves fine.  The error only happens when I try to change the href to point to it.

The href prop is not read-only.  Please help me stop feeling so damn stupid.  Thx
dim im As HTMLImg
 
    For Each im In tc.getElementsByTagName("img")
        f = "c:\temp\" + id + "-" + Trim(Str(i)) + ".jpg"
        If URLDownloadToFile(0&, img.href, f, BINDF_GETNEWESTVERSION, 0&) <> ERROR_SUCCESS Then Stop
        f = "file:///" + f
--->      im.href = f         <----
        i = i + 1
    Next

Open in new window

Comment
Watch Question

Top Expert 2008

Commented:
hi
i checked and href property of HTMLImg is read-only.

Author

Commented:
Hmmm...??  I hit F2 in the ide and bring up the object browser and it is not listed read-only.  Many other props are.  Are you using a better source? (Obviously my results seem to agree more with your source.)

Author

Commented:
Changing the src prop doen't seem to effect the href prop.  But apparently this is what is used tor retrieve an image because the new file will load properly pointing to the new file after changing only src.  Full points to you still if you'll reveal the source (Luke).
Top Expert 2008
Commented:
changing src prop does change the href prop, i did a test like this:

oimage.src = "C:\Winnt\Zapotec.bmp"
Debug.Print oimage.href

Result:
file:///C:/Winnt/Zapotec.bmp



Author

Commented:
I appreciate your efforts.  Guess I pay too much attention to stuff in the ide (which didn't update href simultaneous with src).  Skpped over the siimple var print.  (Doh!)

I'm here ready to give points if you'll just come across with your source that has href as read-only.
Top Expert 2008

Commented:
actually that was listed on my object browser..
HTMLImg-href.bmp

Author

Commented:
Sunuva...   I'm sending you the points.  But that's not what it looks like in my (i guess old) stand-alone vb6.  Don't have a clue why. Seems identical save no r-o attr.  It was the first thing I checked.  If you are using VisStu maybe things are better there.  Anyway, thanx for the work.

Author

Commented:
Confirmed the solution I found with partial additional info as to cause.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.