Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 29-Aug-12 4:24am
Edited 29-Aug-12 4:25am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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:
'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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 532
1 Maciej Los 470
2 Sergey Alexandrovich Kryukov 421
3 CPallini 200
4 Peter Leow 165
0 Sergey Alexandrovich Kryukov 6,888
1 OriginalGriff 5,342
2 Peter Leow 3,962
3 Mika Wendelius 2,850
4 CHill60 2,748


Advertise | Privacy | Mobile
Web04 | 2.8.150224.1 | Last Updated 31 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100