Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: Using PrintDialog with CR Post Reply Post New Topic
Page  of 2 Next >>
Author Message
pooba53
Newbie
Newbie


Joined: 17 Mar 2007
Online Status: Offline
Posts: 16
Quote pooba53 Replybullet Topic: Using PrintDialog with CR
    Posted: 23 Mar 2007 at 12:44pm
I would like to use the PrintDialog function with CR, but have not found any examples of how this is accomplished. Right now I simply print doing:

MyReport.PrintToPrinter(1, False, 0, 0)

My client wants the dialog box to pop up Embarrassed

Thanks!
-Dan
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Mar 2007 at 12:51pm
I haven't done that before. I think you have to open it yourself (it is part of the .NET library). Either that or preview it to the user and then when they print it will pop up.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
pooba53
Newbie
Newbie


Joined: 17 Mar 2007
Online Status: Offline
Posts: 16
Quote pooba53 Replybullet Posted: 23 Mar 2007 at 12:54pm
I'm wading through the documentation on the PrinterDialog class trying to figure out how to accomplish this. A lovely way to spend a Friday afternoon. Amazing how many Google's of folks wondering how to accomplish this.

I shall dive in and report back my findings, Captain.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Mar 2007 at 1:13pm
Thanks. I'll have to make sure I research this one for the .NET 2005 book. It's a good topic.

The problem with .NET 2003 is that not all properties of the Printer Dialog box can be passed to the ReportDocument class. So it will be good to hear what learn. (I'm spending my Friday researching custom role membership providers to integrate with an ASP.NET menu system - then tonight it's all night on the XI book). Fun fun fun...
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
pooba53
Newbie
Newbie


Joined: 17 Mar 2007
Online Status: Offline
Posts: 16
Quote pooba53 Replybullet Posted: 23 Mar 2007 at 1:37pm
So the 8 parameters associated with ReportDocument.PrintOptions are all I have to work with and how those values are set must be captured from the PrintDialog class, correct?

Eesh...you are having more fun than I on this fine Friday.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Mar 2007 at 2:39pm
Yep. That's what you gotta do.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
pooba53
Newbie
Newbie


Joined: 17 Mar 2007
Online Status: Offline
Posts: 16
Quote pooba53 Replybullet Posted: 27 Mar 2007 at 2:17pm
Ended up creating my own "PrintDialog" function by populating a combo box like so:

Dim i As Integer
        Dim pkInstalledPrinters As String

        For i = 0 To PrinterSettings.InstalledPrinters.Count - 1
            pkInstalledPrinters = PrinterSettings.InstalledPrinters.Item(i)
            ComboBox1.Items.Add(pkInstalledPrinters)
        Next

Then I simply captured the number of copies and name of printer and used them with the PrintToPrinter thingy. 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Mar 2007 at 3:14pm
Interesting. Glad it works.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
pooba53
Newbie
Newbie


Joined: 17 Mar 2007
Online Status: Offline
Posts: 16
Quote pooba53 Replybullet Posted: 27 Mar 2007 at 6:22pm
Yeah, I could not find a way to make PrintDialog work directly with the ReportDocument class as you mentioned above.

-Dan
IP IP Logged
harisphang
Newbie
Newbie


Joined: 05 Apr 2007
Online Status: Offline
Posts: 2
Quote harisphang Replybullet Posted: 05 Apr 2007 at 7:41am
well, what you need to do is very simple:
 

ReportDocument rd = new ReportDocument();

rd.Load(@"c:\test\test.rpt");

CrystalReportViewer crv = new CrystalReportViewer();

crv.ReportSource = rd;

crv.PrintReport();

IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.