Solved

Report Print Dialog - click print twice?

Posted on 2006-06-26
6
1,390 Views
Last Modified: 2009-12-16
Using VS2005 windows forms.  I've got a local report with the standard report viewer (actually, a bunch of em).  When you click the print button, the print dialog comes up.  This dialog acts as if it doesn't have focus (but looks like it does).  If you click the print button on the print dialog, nothing happens.  Click it again and it prints.  Actually, you can click anywhere on the print dialog first and it "gains focus" but doesn't look any different.  Then click print and it prints.  Has anyone else noticed this?  Is there a work around till MS gets it fixed?  Any ideas?
0
Comment
Question by:Jahelka
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:sr101880
ID: 16992150
This isn’t anything official it’s more something to check out, but I was having the same problem this fixed it for me.    I setup my report landscape style and had a page size of 14w X 8.5h.    To fix my printing problem, I needed to change the interactive size and the pagesize in the report properties to match.  To do this click on the gray space outside of the body of your report.  This will display the report properties in the properties window.  Then change the sizes to match your output paper size.  The behavior you described stopped after I set the properties to the proper size.  Let me know if you have any questions.
0
 
LVL 1

Author Comment

by:Jahelka
ID: 16992603
DANG!  You got me all excited when I opened up one of my reports and found that I had my interactive size and page size set to two different things!  I do have some landscape reports, and they were different.  I set them to the same and tried it out.  Didn't solve the problem.  I checked out some of my portrait reports, and they do the same thing...  The print dialog LOOKS like it has focus...  Mouse over the buttons or the printers and nothing happens.  If you click anywhere on the print dialog, then the mouse overs work (over a printer, shows current status, over the print button, it gets the yellow glow (in XP)).

Maybe there is something else that is causing the problem and you just think it was pagesize/interactive size?  Any other ideas?
0
 
LVL 4

Expert Comment

by:sr101880
ID: 16992700
I am running my app on a win2k box.  Do you have a win2k box you could try your app on to rule out the operating system?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:Jahelka
ID: 16992762
Lemme give that a shot...  I have tried it on three different computers, but they all have XP.  I'll give it a shot and report back...
0
 
LVL 4

Accepted Solution

by:
sr101880 earned 250 total points
ID: 16992836
I found a big discussion on this at:   http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=177732&SiteID=1

It looks like the code below should fix the problems you are having if you add it to your report viewer form.  Let me know if you have any questions.


Private Sub ReportViewer1_RenderingComplete(ByVal sender As Object, ByVal e As Microsoft.Reporting.WinForms.RenderingCompleteEventArgs) Handles ReportViewer1.RenderingComplete

Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)

Me.ReportViewer1.ZoomMode = ZoomMode.PageWidth

End Sub

0
 
LVL 1

Author Comment

by:Jahelka
ID: 16995289
OK, here is what I did to make the "workaround" work.  MS admits this is a bug, so I'm sure they will have it fixed eventually.  In the mean time...

This code makes sure the report prints the first time everytime (I was also having issues with this):

Use this line:
        Me.rv.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
Right before
        Me.rv.RefreshReport()
on your report form.

This code fixed the print dialog not getting focus issue (add a timer to the form):

    Private Sub rv_Print(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles rvClassResults.Print
        e.Cancel = True
        workaroundTimer.Start()
    End Sub

    Private Sub workaroundTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles workaroundTimer.Tick
        workaroundTimer.Stop()
        Me.rv.PrintDialog()
    End Sub

Thanks for getting me pointed in the right direction!
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question