Ramesh
Ramesh

Reputation: 99

Crystal Report TextBox

I am working on crystal report, i need to pass value(from Winforms) to crystal report Textbox control's like Period:10-11-2009 To 13-11-20009 this value I want pass for crystal report textbox control

advance wishes...

Upvotes: 0

Views: 963

Answers (6)

Peter Ksenak
Peter Ksenak

Reputation: 315

' txtName = textbox name in crystal report
' txtValue = text value to be passed to report

    Dim objText As CrystalDecisions.CrystalReports.Engine.TextObject =RtpDocument.ReportDefinition.Sections(1).ReportObjects(txtName)

    objText.Text = txtValue
    CrystalReportViewer1.ReportSource = RtpDocument

Upvotes: 0

Emad Dehnavi
Emad Dehnavi

Reputation: 3441

Just use parameters and pass the Textbox value :

Example in VB.NET :

Dim rptList As ReportDocument = New ReportDocument()
With rptList
    .Load(strPath)
    .SetDataSource(dtsData)
    rptList.SetParameterValue("SomeName", yourTextBox.Text.trim)
End With

strPath is the path to your .rpt file and dtsData is the dataset.

in SetParameterValue define a name and value, just notice that you should create a parameter with the same name in your crystal report.

Upvotes: 0

eyeshield21
eyeshield21

Reputation: 186

 See the code below

 //Initialize your report
 sample_report yourReport = new sample_report();

 CrystalDecisions.CrystalReports.Engine.TextObject variableName=
 (CrystalDecisions.CrystalReports.Engine.TextObject)
 yourReport.Section2.ReportObjects["nameoftheTextboxInyourReport"];

 variableName.Text = "Period:10-11-2009 To 13-11-20009";

Upvotes: 1

Ramatcse
Ramatcse

Reputation: 1

You can add the from date and to date in the details or header column that you are passing through the data source to the crystal report .. drag those fields from the field explorer and put them into the text field

Upvotes: 0

IordanTanev
IordanTanev

Reputation: 6240

see this link it shows how to pass parametar to crystal report.There are many more examples for this just ask google

link to an example

Upvotes: 2

Adriaan Stander
Adriaan Stander

Reputation: 166396

You can pass values to crystal using parameters. Then you can display these in the reports.

Upvotes: 1

Related Questions