Getting control values into a report

Adrian Aslett

New member
Joined
Nov 19, 2006
Messages
2
Programming Experience
Beginner
I am new to using Crystal Report but the support team have confirmed that it is possible to get values from controls in my application into a report by using a dataset. I have tried many ways to do this but without any success. I suspect it is because I do not know the basics.

Does anyone have a simple example of getting say a value entered into a textbox by a user and then presenting this information in the form of a report that they can print. I am certain that I can buld a bigger picture from an example.

Thanks in advance for any help you can provide
 
alright bro... here we go..

1) create the report.lets say rptTest.
2) create a parameter inside the report lets say @testParam then set the value to string.
3) create a textbox to windows form lets say txtTest
4) try this code

dim objrptTest as new rptTest

objrptTest.parameters.add("@testParam",txtTest.text.trim()) < - - - is this the part u are asking??

then the rest, you know how to create show the report into crystall report viewer right??
 
Thanks, that got me on the right tracks though I'm not sure if it is because I am using VS2008 but I had to use the following code

Try
Dim rpt As New rptTest
Dim obj As String = txtTest.Text.ToString
rpt.ParameterFields.Add("@testparam", ParameterValueKind.StringParameter, DiscreteOrRangeKind.DiscreteValue, "rpttest")
Catch ex As Exception

End Try

to get it to request the parameter and add it to the report. Now all I have to do is to work out how to get the parameter automatically but I think I have found this out as well from your response.

Cheers:)
 
Back
Top