PDA

Click to See Complete Forum and Search --> : load file to image control in a report


Feras
Nov 4th, 2000, 10:40 AM
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 !_!

glitch13
Nov 4th, 2000, 01:16 PM
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.

Feras
Nov 4th, 2000, 05:03 PM
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 : feras@kypros.zzn.com

thanks again.

tulip
Nov 4th, 2000, 10:00 PM
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")

Feras
Nov 5th, 2000, 10:45 AM
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".

Feras
Nov 7th, 2000, 03:53 PM
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.

glitch13
Nov 9th, 2000, 03:06 PM
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!

Steve Stunning
Dec 2nd, 2001, 04:38 PM
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

ae_jester
Jun 12th, 2002, 12:58 PM
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!!!!