Results 1 to 9 of 9

Thread: load file to image control in a report

  1. #1

    Thread Starter
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Unhappy

    Data report object in Visual Basic 6:
    How could I load a picture from a file to image control in the report at Run Time?
    Is it impossible or there is a way to do that?

    NOTE: my report will show some information about one employee including his picture.

    I made a form instead of th report (i'll show only one employee) but I had other problems:
    -1- The maximum height for the form is 9000 and the A4 paper height is about 16000 !!
    -2- When attend to print the form - Me.PrintForm - I got an error '486' says: "Can't print form image to this type of printer".


    ANY HELP PLEASE !_!
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  2. #2
    Member
    Join Date
    Sep 2000
    Location
    New Orleans, LA
    Posts
    37
    im not sure if its possible but if it is, but allow me to suggest a 'neater' (in both meanings of the word) way to do this (which is how i do all my reporting thru VB):

    create a form and put a WebBrowser control on it and dynamically create html files for your reports and display them in the control, you can make it look anyway you want and is much cleaner and easier to debug.

    <RANT>
    This may not be what you want to do but in my experience the dataenv and data reports in VB are buggy and always end up being trouble.
    </RANT>

    if you want, you can drop me your email you a tiny example project ive created using this method.

  3. #3

    Thread Starter
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Smile thank you

    Originally posted by glitch13
    if you want, you can drop me your email you a tiny example project ive created using this method.
    It's very nice to offer that.

    I will be very appreciate to recieve that from you.

    my email is : [email protected]

    thanks again.
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  4. #4
    New Member
    Join Date
    Sep 2000
    Posts
    7


    You can do it as follows:
    DataRpt1.Sections("Section2").Controls("Image").Picture
    = LoadPicture("C:\Windows\MyPicture.bmp")

    A similar question has bothered me for a long time:
    I have put a picture in my Database, now I want to take it out and set to an image in DataReport, how can I do it by code:

    dim cnn as ADODB.connection
    dim rst as ADODB.recordset
    dim rst= NEW ADODB.Recordset
    rst.open "select * from Mytable",cnnParameter, adOpenStatic, adLockOptimistic

    Then how can i take the picture out for an image?

    rst.fields("MyPicture")

  5. #5

    Thread Starter
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85
    Originally posted by tulip


    You can do it as follows:
    DataRpt1.Sections("Section2").Controls("Image").Picture
    = LoadPicture("C:\Windows\MyPicture.bmp")
    But this will cause the Run_Time Error '438': "Object doesn't support this property or method".
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  6. #6

    Thread Starter
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Smile Thanks

    Thanks Brent Kelly, it was more than a great sample.

    It was very helpfull to me, but I had a new little problem when print the report it prints undesirable additional line for the file location (URL) "file://C:\....". How can I get rid of it?

    It could be a silly question but it's my first time using this control.

    Thanks for help, and special thanks for Brent Kelly.
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  7. #7
    Member
    Join Date
    Sep 2000
    Location
    New Orleans, LA
    Posts
    37
    Sorry i forgot to check back to see how it went!

    I emailed you a module and code snippet that would fix the problem with the Header and Footer showing up on the printout. I would have posted it here but it needs a module that can edit the registry because thats where the header and footer info is stored.

    good luck!

  8. #8
    Hyperactive Member Steve Stunning's Avatar
    Join Date
    Jul 1999
    Location
    Fairfax, Virginia
    Posts
    314
    Hey Feras,


    Did you ever figure out how to correct the error while displaying a picture to the data report?

    Does anyone know how I can add a picture at run time to my report? I need a photo to e displayed with the employee information that is generated.

    Thanks
    Steve Stunning

  9. #9
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545
    If this can't be done then every last microsoft employee should be shot!

    I mean come on isnt this a basic feature that many people would need?

    There has to be a way!!!!

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