So...I want to send image source to Crystal Reports document. I'm having a database of maybe 400 members and each one of them is having personal picture...i want to send that picture to Crystal Report document when I click on button for each of my members, is that possible somehow? Thank you...

Here is a C# example that shows how to add a picture to a dataset and display in a Crystal Report.

Hm, but is this example only if you're storing images like and "image"? Because I store images like "String". Thanks...

Do you mean you are storing the file path to an image on the local drive?

that's right, I mean, just "filename.jpg", and then I reach those files through program... Application.StartupPath etc

Like you, I would think there would be an easier way of dynamically loading an image to a report for each record. Googling the subject, so far I'm only finding references similar to first converting the image into a byte array and passing that. I'll keep looking for a LoadImage type method but in the mean time, if you decide to use an example similar to the above C# link, I can covert it to a VB.Net example for you.

If so I have a couple of questions; such as how your calling the report in the first place and how many records show per each report (is it only one member per report or all 400 members each with there own images)?

Just a theory; I'm also wondering if perhaps there is a way to pass the image path as a paramter for the report and have that load an image box. But again I guess that would depend if your report is showing one person at a time or not.

Personal choice; I dont like CR's loading my report data. For instance I dont like pre-assigning it to a datasource (I have multiple sources) and giving the report the control to load the data directly from the db. Its to complicated and in most cases runs slower then needed; however speed of loading a report may or may not be an issue for you. My personal preference is to create a blank report attaching only an empty typed dataset to the report (no pre-defined database connection, no query functions within the report etc). This allows me to be able to create my fields from the dataset tables on the report but control all functionality and data being passed to the report from the VB app. For instance; in my app I create an instance of my typed dataset; fill it with the database data needed to work with and when ready for to display a report, I simply connect that filled dataset as the datasource for the report. The actual report never even has to attach to the database. This works just like the C# example, where he is converting a image in the VB app and storing it in a DataSet/DataTable field and then attaching that as a datasource to the report.

Edited 7 Years Ago by TomW: n/a

I'll keep looking for a LoadImage type method but in the mean time, if you decide to use an example similar to the above C# link, I can covert it to a VB.Net example for you.

I'll be very thankful if you could do this.

If so I have a couple of questions; such as how your calling the report in the first place and how many records show per each report (is it only one member per report or all 400 members each with there own images)?

Well, I've defined few parameters i need...then I take parameter field definitions from my report and after that i'm passing values to my parameters (directly from DataTable or from textboxes), here's an example:
*and yes, one member per report.

Dim crParameterFieldDefinitions As ParameterFieldDefinitions
            Dim crParameterFieldDefinition As ParameterFieldDefinition
            Dim Value As New ParameterValues
            Dim DiscreteValue As New ParameterDiscreteValue

Dim Clan As New Report_
            crParameterFieldDefinitions = Clan.DataDefinition.ParameterFields

DiscreteValue.Value = dtPregled.Rows(navigate).Item(0)
            crParameterFieldDefinition = crParameterFieldDefinitions.Item("'parameter1")
            Value = crParameterFieldDefinition.CurrentValues
            Value.Clear()
            Value.Add(DiscreteValue)
            crParameterFieldDefinition.ApplyCurrentValues(Value)

Just a theory; I'm also wondering if perhaps there is a way to pass the image path as a paramter for the report and have that load an image box. But again I guess that would depend if your report is showing one person at a time or not.

I thought about that but didn't find solution...

And thanks for your recommendations...

One more thing...

when I create simple Report in Visual Studio (not crystal report) how do I preview/call that file? I can't make a new instance like for Crystal reports?
thanks

I'm not sure what your referring too, if not CR what type of report file are your referring too? PrintPreviewDialog maybe?

I'm not sure what your referring too, if not CR what type of report file are your referring too? PrintPreviewDialog maybe?

In Visual Studio 2008 I have an option for three reports...one of them is that what i'm saying, with .rdlc extension.

I belive that is the files for Sql Server Reporting Services. I believe there supposed to be web browser based type reports but am not positive.

I belive that is the files for Sql Server Reporting Services. I believe there supposed to be web browser based type reports but am not positive.

Ok, thanks for answer.
When you have time...please put here that "translated" code. thanks

I downloaded that example, it is actually in vb.net not C#

thanks for that ;)

i want to ask you (or anyone else) one more thing...let's say i need an report that will show me payed "membership fee" for year that I want to choose. How can I get something like this? I know that I can make separated reports for single year, but I want all in one report document...just to select year that I want to see. Any idea?

*and yes, i have separated tables for "year" and "membership fee"...

And yes..that's just one of few examples...

One more example..
I have members in my evidence and every member belongs to one "football center", i would also like to have an option to print my members only by "football center" that I select...hope someone will help me, if not, i will probably open new topic :)

You can create report parameters where the user would have to select a date before the report opens up. Personally I would do all this sort of stuff on the front end in the VB app and only fill your dataset with the info you want passed to the report. But yes, if you want to discuss this further it probably should be its own thread.

This article has been dead for over six months. Start a new discussion instead.