Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: pass variable in vb.net to crystal w/o using a DB? Post Reply Post New Topic
Author Message
nebchill26
Newbie
Newbie


Joined: 06 Nov 2008
Location: Philippines
Online Status: Offline
Posts: 20
Quote nebchill26 Replybullet Topic: pass variable in vb.net to crystal w/o using a DB?
    Posted: 11 Feb 2009 at 7:26pm
does anyone know how i can pass a variable/parameter from visual basic.net without using a database?

an example is i like to pass a the value of a text box in vb.net to crystal report.
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 13 Feb 2009 at 12:59pm
You can create an empty formula and locate it on the report. Then you can pass the variable to the text property of the formula. I dont have a sample in front of me. I think the collection of formulas is found in the Report Document object model and is in Report Definitions. I could probably supply a sample later today if still needed.
 
I often use this in passing strings I generate from code to display on the report.
 
Regards,
 
John W.
 
 
IP IP Logged
nebchill26
Newbie
Newbie


Joined: 06 Nov 2008
Location: Philippines
Online Status: Offline
Posts: 20
Quote nebchill26 Replybullet Posted: 15 Feb 2009 at 4:03pm
could you give me an example of this please?thanks
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 17 Feb 2009 at 8:52am
Here is a sample from the CR .Net API reference. The idea is to create an empty formula box. Then use this method to pass in a value. You can reference the formula field by its name as a string and not its index value.  I do this when I have some dynamic value I create in code that is not in the database but need it to show on the report.
---------------
      Private Sub UpdateFormulas(ByVal myReportDocument As ReportDocument)
         myReportDocument.DataDefinition.FormulaFields.Item("myformula").Text = "{file.SALES} *.1"
         myReportDocument.DataDefinition.FormulaFields.Item(2).Text = "{file.SALES} + {file.COMMISSION}"
      End Sub
 ----------------
 
Hope this helps.
 
Regards,
 
John W.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.