Solved

Report Print Dialog - click print twice?

Posted on 2006-06-26
6
1,324 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 1

Author Comment

by:Jahelka
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now