photo in vb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aaryan
    New Member
    • Nov 2006
    • 82

    #1

    photo in vb

    hi all,
    i have stored photo's path in my sql2000 and now in vb i have created a picture box. i want to retrieve the photo in this.
    here is my sample code.
    (assuming at present my database contains only one record)
    dim con as new adodb.connectio n
    dim rs as new adodb.recordset
    con.connections tring= "-----"
    rs.open "select * from foto",con,2,3
    command_click()
    picture1= loadpicture('rs (0)')

    the error says cannot find file "C:\....." whatever path i gave in my db.
    cd u ppl help me solve this.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by aaryan
    hi all,
    i have stored photo's path in my sql2000 and now in vb i have created a picture box. i want to retrieve the photo in this.
    here is my sample code.
    (assuming at present my database contains only one record)
    dim con as new adodb.connectio n
    dim rs as new adodb.recordset
    con.connections tring= "-----"
    rs.open "select * from foto",con,2,3
    command_click()
    picture1= loadpicture('rs (0)')

    the error says cannot find file "C:\....." whatever path i gave in my db.
    cd u ppl help me solve this.
    This might sound silly, but have you checked that the path is correct? The error sounds fairly straightforward .

    Another possibility, I suppose, is that it's not a supported image type for the picturebox.

    Comment

    • sashi
      Recognized Expert Top Contributor
      • Jun 2006
      • 1749

      #3
      Originally posted by aaryan
      hi all,
      i have stored photo's path in my sql2000 and now in vb i have created a picture box. i want to retrieve the photo in this.
      here is my sample code.
      (assuming at present my database contains only one record)
      dim con as new adodb.connectio n
      dim rs as new adodb.recordset
      con.connections tring= "-----"
      rs.open "select * from foto",con,2,3
      command_click()
      picture1= loadpicture('rs (0)')

      the error says cannot find file "C:\....." whatever path i gave in my db.
      cd u ppl help me solve this.
      Hi there,

      What's the format of those pictures? Make sure you are pointing at the correct physical path to be able to view pictures with the LoadPicture function, hope it helps. Good luck & Take care.

      Comment

      • aaryan
        New Member
        • Nov 2006
        • 82

        #4
        Originally posted by sashi
        Hi there,

        What's the format of those pictures? Make sure you are pointing at the correct physical path to be able to view pictures with the LoadPicture function, hope it helps. Good luck & Take care.
        hi all,
        the image is in jpeg format. so there should be no doubt whether the picture box supports it or not. i checked the path too. it was correct. by the way is my syntax in making the picture display is correct, namely ....loadpicture ('rs(0))?

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by aaryan
          the image is in jpeg format. so there should be no doubt whether the picture box supports it or not. i checked the path too. it was correct. by the way is my syntax in making the picture display is correct, namely ....loadpicture ('rs(0))?
          Ah! Good point. The syntax is wrong. You are trying to load a picture called "rs(0)", which most likely doesn't exist. Try losing the quotes.

          Comment

          • sashi
            Recognized Expert Top Contributor
            • Jun 2006
            • 1749

            #6
            Originally posted by Killer42
            Ah! Good point. The syntax is wrong. You are trying to load a picture called "rs(0)", which most likely doesn't exist. Try losing the quotes.
            Hi Killer,

            I hope the case is solved as of this thread :) Take care buddy.

            Comment

            Working...