Results 1 to 10 of 10

Thread: images from database in vb reports

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    15

    images from database in vb reports

    i'm working on vb6 with a medical application.

    at the end of the program i need to display the results
    of the analysis.

    every value has an associated picture to inform the user
    about the value's related anatomy.

    the final report will looks like

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    IMAGE......................|...Value.....|..normal value...|..inference..|
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++


    -----------------------------------------------------------------------
    Header 1 (eg: nose width)
    -----------------------------------------------------------------------
    ___________
    image1...................|...22.4mm ..|...20-24mm ......|...looks normal
    ___________

    -----------------------------------------------------------------------
    Header 2 (eg: nose length)
    -----------------------------------------------------------------------
    __________
    image2..................|...24mm .....|...30-34mm ........|..looks short
    ___________

    ----------------------------------------------------------------------
    :::::::::::::::

    :::::::::::::::

    :::::::::::::::

    :::::::::::::::


    the images' path will be stored in the database against each record's
    identifier (usually that which comes in the header)

    i would like to use the inbuilt datareports.


    can some one please enlighten me on this and help me? please !

    thank you
    Dr.Pavan Kumar M

  2. #2
    Lively Member mowafy's Avatar
    Join Date
    Jul 2005
    Posts
    116

    Re: images from database in vb reports

    are you using crystal report with vb
    if yes them you need to embeded report by using crystal report designer with vb
    then add picturebox to the detailes section on the format sections use
    picturebox.loadpicture (your picture path)

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    15

    Re: images from database in vb reports

    can't it be done with the datareport tool of vb?

    i don't have the crystal reports installed.

    thanks a lot
    Dr.Pavan Kumar M

  4. #4
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: images from database in vb reports

    I would suggest that you not store image in a database, unless you have good reason for doing so. It is alot easyer, painless, and faster, to just store the images on the filesystem and load them when needed. You can just store the filename and or location of the image in the db, and reference it.

  5. #5
    Junior Member
    Join Date
    Nov 2004
    Location
    Philippines
    Posts
    27

    Re: images from database in vb reports

    Try saving just the filename of the picture to the database. If you are using a data report, insert the following codes before you call the report.

    VB Code:
    1. 'check if the filename of the picture exists
    2. If dir(rs.Fields("PicFileName")) <> "" Then
    3.      'sets the report picture box
    4.      Set dtrPicture.Sections("Sect1").Controls("img1").Picture = LoadPicture(rs.Fields("PicFileName"))
    5. Else
    6.      'clears the report picture box
    7.      Set dtrPicture.Sections("Sect1").Controls("img1").Picture = Nothing
    8. End If
    9. dtrPicture.Refresh
    10. dtrPicture.Show

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    15

    Re: images from database in vb reports

    i tried this code but it says the object does not support this property
    or method !!!

    and i have one more doubt in this method..

    will this dynamically add the different images for each record
    if i store all the filepaths of the images in the database?

    thanks a lot for the help
    Dr.Pavan Kumar M

  7. #7
    Frenzied Member wiz126's Avatar
    Join Date
    Jul 2005
    Location
    Mars,Milky Way... Chit Chat Posts: 5,733
    Posts
    1,080

    Re: images from database in vb reports

    i would sugesst that you shoudn't store the images in the database since its a lot easyer and time consuming and space consuming too. just stor them in sysfolder and use them by uploading them as needed
    1) If your post has been adequately answered please click in your post on "Mark Thread Resolved".
    2) If someone has been useful to you please show your respect by rating their posts.
    3) Please use [highlight="VB"] 'your code goes in here [/highlight] tags when posting code.
    4) Before posting your question, make sure you checked this links:
    MICROSOFT MSDN -- VB FORUMS SEARCH

    5)Support Classic VB - A PETITION TO MICROSOFT

    ___________________________________________________________________________________
    THINGS TO KNOW ABOUT VB: || VB Examples/Demos
    What are Classes?
    || -
    Where to place a sub/function?(global) || Webbrowser control

  8. #8
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Manila, Philippines
    Posts
    486

    Re: images from database in vb reports

    i think saving the pic in database is necessary for drpavan for the picture corresponds to data itself

  9. #9
    Junior Member
    Join Date
    Nov 2004
    Location
    Philippines
    Posts
    27

    Re: images from database in vb reports

    Quote Originally Posted by drpavan
    i tried this code but it says the object does not support this property
    or method !!!

    and i have one more doubt in this method..

    will this dynamically add the different images for each record
    if i store all the filepaths of the images in the database?

    thanks a lot for the help
    Object does not support this property - You're getting the wrong index/name of the section/control. Check the index/ name of the section/rptimage control and it will surely work.

    Unfortunately you need to insert that code inside a loop to be able to show the image for each record. In my case, I needed 7 pictures in one page. So I added 7 indexes of that image control. I just don't know if there's an easier way but this solved my problem.

  10. #10
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: images from database in vb reports

    You might be able to create a mailmerge type app if you have Word available, or as I've said before, create your own reports using the RichTextBox control.

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