Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vb.net and Crystal Reports

Status
Not open for further replies.

JAM1011

Programmer
Feb 13, 2010
6
IE
Hey all.

I would like to pass parameters to a report Using from my vb.net form. I have a form with a viewer and would just like to sent in the too parameter values. I don't have any Idea how to do this so any help at all would be welcome.

Thanks
 
You don't say which version of VS or Crystal you're using.

Try looking here:


Click on Crystal Reports .NET SDK. There are serveral samples and tutorial code in the links that appear.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Here's a real simple way to pass parameters. The code is on the crviewer form.

Dim strLocID As String = CType(Session.Item("strLocID"), String)
strLocID = Session.Item("strLocID")
Dim strCustID As String = CType(Session.Item("strCustID"), String)
strCustID = Session.Item("strCustID")
Dim strOrderID As String = CType(Session.Item("strOrderID"), String)
strOrderID = Session.Item("strOrderID")
txtLocID.Text = strLocID
txtCustID.Text = strCustID
txtOrderID.Text = strOrderID

crViewer1.Visible = True
crReport = New CrystalReport1
'crViewer1.Width = "750px"
crViewer1.Zoom(100)
crReport.SetParameterValue("LocID", txtLocID.Text)
crReport.SetParameterValue("CustID", txtCustID.Text)
crReport.SetParameterValue("OrderID", txtOrderID.Text)

crViewer1.ReportSource = crReport
crViewer1.ShowFirstPage()
crViewer1.Visible = True
ExportData(crReport)
crReport.Dispose()
crReport.Close()

In this example I am passing 3 parameters to the report.
Good Luck
Cathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top