Member Avatar for Peric

I've asked few similar questions 'til now but here's one more.

Well, I have example of Crystal Report document, in that document I have 3 fields from 2 tables (loaded from my database). What I'm trying to do is to access one of those fields (year field) programmaticly and pass only one value...let's say I only want to show year "2006."
I've tried different things but nothing works 'til now. Last thing I've tried is this code:

Dim report As New Report123

rep03.Section3.ReportObjects.Item("Field1").Name.ToString

So, with this, I can access to the field i want...but I don't know how to set or get any of his value...this code above only gets name of that field, I just put that for an example.
I just want to do next: give user a chance to print different reports for different years, and I want to have some combobox menu...hope someone could help me. thanks

Recommended Answers

All 4 Replies

Member Avatar for Peric

Anyone, please?

maybe this example is even closer...

Dim aad As CrystalDecisions.CrystalReports.Engine.FieldObject

aad = rep03.ReportDefinition.ReportObjects.Item("field1")

but I don't know what to do after this :)

Member Avatar for Peric

in the end, i will use this, it gives me result that i've been looking for:

Reports_Dialog.CrystalReportViewer1.SelectionFormula = "{Season.Year} = '2006.'"
Member Avatar for Peric

Well, as I said it...I found out how to change some things in Crystal Reports...but I need one more thing.

When i'm sending value to a textObject I have something like this:

Dim name As CrystalDecisions.CrystalReports.Engine.TextObject
name = Report1.ReportDefinition.ReportObjects.Item("textImePrezime")
        name.Text = dtName.Rows(0).Item(0)

and this works great...

but I want to change picture in Crystal Reports, i'm trying something like this:

Dim picture As CrystalDecisions.CrystalReports.Engine.PictureObject
            picture = Report1.ReportDefinition.ReportObjects.Item("Picture3")

After that i'm trying to give that PictureObject some kind of path or something, but i don't have that option.
Does anyone know how to do this??? Thank you

CR has always seemed difficult to use, the documentation for it is very difficult to understand or even find what you are looking for. I dont think the lack of responses are due to your questions just that most have a problem working with CR themselves.

As for passing parameters, I would first create the parameter field on the report, say the name is "Par1". I would then call and pass the parameter value as follows:

rpt.Load
rpt.SetDataSource(myDataSet)
rpt.SetParameterValue("Par1", txtReportParameter.Text.Trim)

As far as passing a file path to load the picture, I dont think this can be done. Of course I would think that this would/should be possible but I havent seen a way of doing so, except what Ive shown you before as an example.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.