开发者

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 textbo开发者_StackOverflowx control

advance wishes...


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


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


 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";


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


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.


' 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜