Print Page | Close Window

Pulling in values from an INI file

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1652
Printed Date: 03 May 2025 at 2:20pm


Topic: Pulling in values from an INI file
Posted By: Enzyme80
Subject: Pulling in values from an INI file
Date Posted: 08 Nov 2007 at 10:10am
Hey guys,

I have created a Crystal Report and got it up and running. This report will be exactly the same for all of my customers except for where it says the company name (it is 4 text fields) will change to be their company. The only place where these values are set are in the ini file and then are read into session variables as such
session("CNAME") = company name
Session("ADR1") = adr1
Session("ADR2") = adr2
Session("CSZ") = CSZ

Now all of these sessions are filled in but I cannot figure out how to make them also fill in for crystal reports. I have tried some different things but have yet to get it to work.

Some more info. This is with visual studio 2005 writing in vb.net and using the crystal reports that comes with that version of VS.

Thanks
Kevin



Replies:
Posted By: Enzyme80
Date Posted: 08 Nov 2007 at 10:39am

Dim rptTxtGroup As TextObject
        rptTxtGroup = rpt.ReportDefinition.ReportObjects.Item("Text15")
        rptTxtGroup.Text = Session("Label")
        rptTxtGroup = rpt.ReportDefinition.ReportObjects.Item("Text16")
        rptTxtGroup.Text = Session("ADR1")
        rptTxtGroup = rpt.ReportDefinition.ReportObjects.Item("Text17")
        rptTxtGroup.Text = Session("TEL")
        rptTxtGroup = rpt.ReportDefinition.ReportObjects.Item("Text18")
        rptTxtGroup.Text = Session("City")

This pretty much does what i need at least from what I can tell.  I have done a couple test and they have all passed.




Print Page | Close Window