Click here to Skip to main content
15,921,793 members
Home / Discussions / C#
   

C#

 
AnswerRe: modify type of dataset column Pin
howlettt30-Jan-09 4:38
howlettt30-Jan-09 4:38 
GeneralRe: modify type of dataset column Pin
pippyn30-Jan-09 5:06
pippyn30-Jan-09 5:06 
GeneralRe: modify type of dataset column Pin
howlettt30-Jan-09 6:03
howlettt30-Jan-09 6:03 
GeneralRe: modify type of dataset column Pin
pippyn30-Jan-09 6:22
pippyn30-Jan-09 6:22 
QuestionPrint the columns of a DataGrid in individual blocks Pin
pavanip30-Jan-09 4:00
pavanip30-Jan-09 4:00 
AnswerRe: Print the columns of a DataGrid in individual blocks Pin
leeoze30-Jan-09 10:04
leeoze30-Jan-09 10:04 
GeneralRe: Print the columns of a DataGrid in individual blocks Pin
pavanip30-Jan-09 19:40
pavanip30-Jan-09 19:40 
AnswerRe: Print the columns of a DataGrid in individual blocks Pin
leeoze30-Jan-09 23:50
leeoze30-Jan-09 23:50 
OK, it's actualy very easy thing to do.
The main idea is to use the subreports option in the crystalreport item.

You need to add a new DataSet item to your project (Add new item -> c# -> DataSet)
In this new dataset add new datatable and add rows according to your original table (i.e. Name, Email, and etc.) This DataSet will not be used to host the data, rether this will only be used to set as a Template for your report.

You add a CrystalReport item to your project (Add new item -> Reports -> CrystalReport)
In the wizard just choose standard and finish the wizard after doing so.

Now you should have a blank report with 5 sections.
Right click the the white blank area in between "Section 3 (Details)" to "Section 4 (Report Footer)" and choose insert -> subreport.
In the dialog the opens up choose "Create a subreport with Report Wizard".
Name the report with the title of what you wish to display (i.e. Name) and click on "Report Wizard..."

A new dialog name "Standard Report..." should opens up.
Expand Project data -> Ado.NET DataSets -> YOURDATASETNAME and by clicking the double arrows to the right of this treeview add your datatable to this report. after doing so click next.
now add only the field you wish to display on this table (i.e. Name). Click Next and now you can either finish or click next to the end.

Up until now you have created the first section wich will show only the names!

In order to show other columns, one under the other, you need to add more sections.
Right click the Gray Title named "Section 3 (Details)" and choose insert section below.
Now do the same to add subreport with your desired column. keep adding sections for each column you wish to display.

In order to display your report you need to do three things.
Add a CrystalReportViewer object to a Form.
By using the code, Attach your data to the report and the report to the viewer.

//YourDataSet is a DataSet object which should contain all your data from any datasource you have
//You can create and simulate a dataset if you wish just to try the report. try searching online for how to do so.

            YourCrystalReport objReport = new YourCrystalReport(); //Creating the report object
            objReport.SetDataSource(YourDataSet); //Binding your data to the report
            TheCrystalReportViewerObject.ReportSource = objReport;



good luck...
AnswerRe: Print the columns of a DataGrid in individual blocks Pin
Najmal31-Jan-09 4:13
Najmal31-Jan-09 4:13 
Questiongetting the tip message for method during design time Pin
Blubbo30-Jan-09 3:33
Blubbo30-Jan-09 3:33 
AnswerRe: getting the tip message for method during design time Pin
musefan30-Jan-09 3:38
musefan30-Jan-09 3:38 
GeneralRe: getting the tip message for method during design time Pin
Blubbo30-Jan-09 3:45
Blubbo30-Jan-09 3:45 
GeneralRe: getting the tip message for method during design time Pin
musefan30-Jan-09 3:47
musefan30-Jan-09 3:47 
GeneralRe: getting the tip message for method during design time Pin
Ennis Ray Lynch, Jr.30-Jan-09 3:54
Ennis Ray Lynch, Jr.30-Jan-09 3:54 
GeneralRe: getting the tip message for method during design time Pin
PIEBALDconsult30-Jan-09 6:50
mvePIEBALDconsult30-Jan-09 6:50 
GeneralRe: getting the tip message for method during design time Pin
Pete O'Hanlon30-Jan-09 4:45
mvePete O'Hanlon30-Jan-09 4:45 
GeneralRe: getting the tip message for method during design time Pin
DaveyM6930-Jan-09 9:19
professionalDaveyM6930-Jan-09 9:19 
GeneralRe: getting the tip message for method during design time Pin
Najmal31-Jan-09 4:18
Najmal31-Jan-09 4:18 
Questioncomplicated string Pin
bfis10813730-Jan-09 3:18
bfis10813730-Jan-09 3:18 
AnswerRe: complicated string Pin
#realJSOP30-Jan-09 3:24
professional#realJSOP30-Jan-09 3:24 
GeneralRe: complicated string Pin
bfis10813730-Jan-09 3:36
bfis10813730-Jan-09 3:36 
GeneralRe: complicated string Pin
Ben Fair30-Jan-09 3:40
Ben Fair30-Jan-09 3:40 
GeneralRe: complicated string Pin
SeMartens30-Jan-09 3:48
SeMartens30-Jan-09 3:48 
GeneralRe: complicated string Pin
#realJSOP30-Jan-09 4:01
professional#realJSOP30-Jan-09 4:01 
GeneralRe: complicated string Pin
Najmal31-Jan-09 4:29
Najmal31-Jan-09 4:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.