Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The Issue Is I want to
Fill the Data in DataGridView
Manually .
and on Button CLick Want to send the data
to Crystal Reports.
I have Done the Process of filling the
DataGridView manually,
But Is Stuck in How to send The Data Of DataGridView
to Crystal Reports.

Have Done Similar Operations in Case of Text Boxes.In which
I have Used Parameter Fields.

I It possible to Send the DataGridView Column Data
To crystal Reports Using parameter Fields,
if Yes.
Please Assist.
Posted
Updated 15-Mar-17 9:20am
v2

You don't pass a DataGridView object into a Crystal Report, you instead pass a DataSet object (which can be bound to the DataGridView if you like).

You'll need to design your crystal report with XML Schema that matches the schema of your DataSet object.

Here[^] is one example. And here[^] is a tutorial I found on google. I'm sure you can find other examples and tutorials on CodeProject too.

Hope this helps.
 
Share this answer
 
Assuming you have created and filled your dataset using the following:
dim ds as new reportDataset 'replace reportDataset with the Name of your Dataset
If you look at a question I asked "Cannot get Crystal Reports vb.net 2008 to display data." you will see how I did it. This works, by the way. I made a stupid mistake that I didn't see until answering your question.

I found it easier to instantiat a report object (objRpt) and put the report in a CrystalReportViewer, than declare a Report Document.
After filling the DataSet with your data add the following code:
VB
'Assuming you have created and filled your dataset using the following:

dim ds as new reportDataset 'replace reportDataset with the Name of your Dataset

'If you look at a question I asked, "Cannot get Crystal Reports vb.net 2008 to display data", you will see how I did it. This code works, by the way. I made a stupid mistake that I didn't see until answering your question.

'I found it easier to instantiate a report object (objRpt) and put the report in a CrystalReportViewer, than declaring a Report Document.

'After filling the DataSet with your data add the following code:

Dim objRpt As New rptSchedule 'Replace rptSchedule with name of your report
objRpt.SetDataSource(ds) 'ds = the DataSet object you created
CrystalReportViewer1.ReportSource = objRpt 'Set the report source
CrystalReportViewer1.Refresh() 'Refresh the report.
 
Share this answer
 
Comments
Member 12695573 24-Aug-16 23:18pm    
can u help in same this code in c#

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900