Crystal viewer

  • Thread starter Robert Schuldenfrei
  • Start date
R

Robert Schuldenfrei

Dear NG,

I have Crystal Reports working to a file and directly to the printer with
the following:

private void mnuInvRep1301_Click(object sender, System.EventArgs e)


{

ReportDocument report = new ReportDocument();

report.Load("C:\\database\\MCS-3-SQL\\MCS-3inC#\\INV\\Reports\\rpt1301.rpt")
;

//Send report to a file

//report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.RichText,"C:\
\tmp\\CrystalOut.rtf");

//Send report directly to the default printer

report.PrintToPrinter(1, false, 0, 0);

MessageBox.Show("Crystal terminated normally");

}

I would like to use the Windows viewer. I have created Form1. I added the
ReportDocument to Form1. On a menu item click I would like to instantiate
the form to myForm and then use the form as follows:

myForm.ShowDialog();

How do I instantiate the form?



TIA - Bob ([email protected])
 
K

Kevin Yu [MSFT]

Hi Robert,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to view crystal report on a
windows form. If there is any misunderstanding, please feel free to let me
know.

As far as I know, if you need to view it on a windows form, you need to
place a crystal report viewer on the form, and assign the report document
report source to the viewer. Then you just use the following to show dialog
box.

Form1 myForm = new Form1();
myForm.ShowDialog();

Crystal Report is not supported by Microsoft. For more information related
to this issue please check the following link:
https://support.crystaldecisions.com

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
R

Robert Schuldenfrei

Thank you Kevin,

That worked fine. I have a few formating issues, like landscape
orientation, but I am off and running. I have a lot of C# and Crystal
learning to do, but I am well on my way. Is Crystal Reports the best way to
integrate about 100 reports from a SQL database using C#?

Cheers,

Bob

Robert Schuldenfrei
(e-mail address removed)
 
R

Robert Schuldenfrei

Hi Again,

I thought I could adjust the viewer properties without any further aid from
the NG, but I was wrong. When I print my reports to a file or directly to
the printer, the orientation is landscape. This was set in the report
itself using Designer | Printer Setup and setting the printer to landscape.
When I send the report to the viewer, using the statements listed below, the
lines are truncated because the viewer is defaulting to portrait
orientation. How can I change this viewer property? The book I am using is
Neil FitzGerald et. al., Using Crystal Reports 10. It is very good at
explaining Crystal, but is very brief on explaining the .NET material. As
ever, thank you in advance for your help.

Sincerely,

Bob

Robert Schuldenfrei
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top