Click here to Skip to main content
15,887,416 members
Home / Discussions / C#
   

C#

 
AnswerRe: Hide Form Pin
Gavin Jeffrey30-Sep-05 2:18
Gavin Jeffrey30-Sep-05 2:18 
GeneralRe: Hide Form Pin
spif200130-Sep-05 2:27
spif200130-Sep-05 2:27 
AnswerRe: Hide Form Pin
Robert Rohde30-Sep-05 10:00
Robert Rohde30-Sep-05 10:00 
GeneralRe: Hide Form Pin
spif20012-Oct-05 20:58
spif20012-Oct-05 20:58 
GeneralRe: Hide Form Pin
Robert Rohde4-Oct-05 18:51
Robert Rohde4-Oct-05 18:51 
GeneralRe: Hide Form Pin
spif20014-Oct-05 20:33
spif20014-Oct-05 20:33 
QuestionCrystal Reports Pin
Willem Le Roux29-Sep-05 23:26
Willem Le Roux29-Sep-05 23:26 
AnswerRe: Crystal Reports Pin
Susan Hernandez30-Sep-05 13:14
Susan Hernandez30-Sep-05 13:14 
I have to say I officially hate Crystal, sorry. But I have to use it. I'll try to tell you what I have done, and hopefully this will get you started in the right direction.

First I created an XSD by clicking on the project in question --> Add New Item --> XML Schema. Open the schema in the designer and put in the fields and their data types for the data as you want to see it on the report. You can add elements and such by right-clicking in the schema window.

After you are done with that, right-click in the schema window and select Generate Dataset. If you were to click your "Show All Files" button on your project, you would notice that you now have a new .cs file underneath your xsd schema. This is known as a "strongly-typed dataset", if I'm not mistaken.

Now, Crystal is ready to accept your information. The next step is designing the Crystal report itself. Add New Item --> Crystal Report, and you get a report file .rpt. If you right-click in the Field Explorer (on the left hand side) [and probably this is available somewhere in the menu system], you need to find Add/Remove Database. You should see a list of potential data sources, and you should see your strongly-typed dataset here.

I won't walk you through designing a report [edit]although happy to give help if requested[/edit]...

Next step is displaying the report. Create a new blank Windows Form in your project, and drag a CrystalReportViewer component on to the form, and dock it using Fill. [BTW, You probably need to be referencing "CrystalDecisions.CrystalReports.Engine", "CrystalDecisions.ReportSource", "CrystalDecisions.Shared", and "CrystalDecisions.Windows.Forms" in your project]. If you don't see a CrystalReportViewer component anywhere in your toolbox, right-click your toolbox, choose add/remove items, and scroll to CrystalReportViewer.

Finally, to actually pass the information and show the form, you need some or all of the following code:
//// Basically here I'm just saying instantiate and somehow 
//// fill your dataset using Data Adapters, reading in XML, etc
dsMyTypedDataSet reportSource  = new dsMyTypedDataSet ();
reportSource.ReadXml(myFileName);
.
rptMyReportClass rpt = new rptMyReportClass();
rpt.SetDataSource(reportSource);
.
//// Set any parameters on the Crystal Report, if you set any up
rpt.SetParameterValue("MyParam", myValue); 
.
//// Get the form that you have the viewer on
frmReportViewer mdiReportViewer = new frmReportViewer();
.
//// FUDGE - either you're doing this on the viewer form, or
//// you've passed in "rpt" INTO the viewer form....
crystalReportViewer1.ReportSource = rpt;   //// this happens on the viewer form
.
.....
.
mdiReportViewer.Show();
.
//// FUDGE - something you can do on the viewer form if you want
crystalReportViewer1.ShowLastPage();
NumPages = crystalReportViewer1.GetCurrentPageNumber();
crystalReportViewer1.ShowFirstPage();
this.Text += String.Format(" : {0} Page{1}", NumPages, NumPages == 1 ? "" : "s");

This last bit was what I do to retrieve the number of pages and display it, else it doesn't know how many pages you have.

This is not perfect I'm sure, but please try it out and let me know what doesn't work so I can help you fill in the details.

-- modified at 11:18 Monday 3rd October, 2005
GeneralRe: Crystal Reports Pin
Willem Le Roux2-Oct-05 23:02
Willem Le Roux2-Oct-05 23:02 
GeneralRe: Crystal Reports Pin
Susan Hernandez3-Oct-05 6:55
Susan Hernandez3-Oct-05 6:55 
GeneralRe: Crystal Reports Pin
Willem Le Roux4-Oct-05 0:03
Willem Le Roux4-Oct-05 0:03 
QuestionGet motherboard serial number Pin
Willem Le Roux29-Sep-05 23:22
Willem Le Roux29-Sep-05 23:22 
AnswerRe: Get motherboard serial number Pin
Dave Kreskowiak30-Sep-05 8:21
mveDave Kreskowiak30-Sep-05 8:21 
GeneralRe: Get motherboard serial number Pin
Willem Le Roux2-Oct-05 23:17
Willem Le Roux2-Oct-05 23:17 
GeneralRe: Get motherboard serial number Pin
Dave Kreskowiak6-Oct-05 11:52
mveDave Kreskowiak6-Oct-05 11:52 
GeneralRe: Get motherboard serial number Pin
Willem Le Roux6-Oct-05 22:55
Willem Le Roux6-Oct-05 22:55 
GeneralRe: Get motherboard serial number Pin
Dave Kreskowiak7-Oct-05 16:07
mveDave Kreskowiak7-Oct-05 16:07 
QuestionHow To make Toolbar Pin
A.Grover29-Sep-05 23:18
A.Grover29-Sep-05 23:18 
AnswerRe: How To make Toolbar Pin
| Muhammad Waqas Butt |29-Sep-05 23:45
professional| Muhammad Waqas Butt |29-Sep-05 23:45 
QuestionCrystal Report selection Problem Pin
| Muhammad Waqas Butt |29-Sep-05 22:52
professional| Muhammad Waqas Butt |29-Sep-05 22:52 
QuestionWin32 api Pin
rakesh_nits29-Sep-05 22:07
rakesh_nits29-Sep-05 22:07 
AnswerRe: Win32 api Pin
Anonymous30-Sep-05 8:18
Anonymous30-Sep-05 8:18 
QuestionStandard Deviation Graph through GDI+ in .NET? Pin
parvinder sehrawat29-Sep-05 22:04
parvinder sehrawat29-Sep-05 22:04 
AnswerRe: Standard Deviation Graph through GDI+ in .NET? Pin
Stefan Troschuetz29-Sep-05 23:22
Stefan Troschuetz29-Sep-05 23:22 
GeneralRe: Standard Deviation Graph through GDI+ in .NET? Pin
parvinder sehrawat29-Sep-05 23:46
parvinder sehrawat29-Sep-05 23:46 

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.