Passing a value to Crystal Reports fields

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2009
Posts: 44
Reputation: Peric is an unknown quantity at this point 
Solved Threads: 0
Peric Peric is offline Offline
Light Poster

Passing a value to Crystal Reports fields

 
0
  #1
31 Days Ago
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:

  1. Dim report As New Report123
  2.  
  3. 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
Last edited by Peric; 31 Days Ago at 5:15 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 44
Reputation: Peric is an unknown quantity at this point 
Solved Threads: 0
Peric Peric is offline Offline
Light Poster
 
0
  #2
31 Days Ago
Anyone, please?

maybe this example is even closer...

  1. Dim aad As CrystalDecisions.CrystalReports.Engine.FieldObject
  2.  
  3. aad = rep03.ReportDefinition.ReportObjects.Item("field1")

but I don't know what to do after this
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 44
Reputation: Peric is an unknown quantity at this point 
Solved Threads: 0
Peric Peric is offline Offline
Light Poster
 
0
  #3
31 Days Ago
in the end, i will use this, it gives me result that i've been looking for:

  1. Reports_Dialog.CrystalReportViewer1.SelectionFormula = "{Season.Year} = '2006.'"
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 44
Reputation: Peric is an unknown quantity at this point 
Solved Threads: 0
Peric Peric is offline Offline
Light Poster
 
0
  #4
22 Days Ago
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:

  1. Dim name As CrystalDecisions.CrystalReports.Engine.TextObject
  2. name = Report1.ReportDefinition.ReportObjects.Item("textImePrezime")
  3. 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:
  1. Dim picture As CrystalDecisions.CrystalReports.Engine.PictureObject
  2. 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
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 303
Reputation: TomW is on a distinguished road 
Solved Threads: 43
TomW TomW is offline Offline
Posting Whiz
 
0
  #5
21 Days Ago
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.
Last edited by TomW; 21 Days Ago at 9:34 am.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC