printdialog

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to send a performclick to a button on a printdialog?

I know you can do an if statement similar to:

if windows.forms.dialogresult.cancel then
msgbox("User cancelled print option")
end if

But I would like to open the print dialog and automatically perform the
"Print" button to save the user one more step.

Thanks much!
 
You can't send a click event to an open PrintDialog.

However, you can get around this by automating the print job in the
background, and avoiding the PrintDialog all together.

If you're interested in how to accomplish this, let me know, and I'll go
into greater detail.
 
Sure - I'd love to hear some details!

I should make note that it's a custom sized/pre-formatted paper that the
reportviewer prints on.
 
What is the source of the item you are printing? Crystal Report, Word Doc,
Text File...?

Give me some more specifics about what exactly you are trying to
automatically print, and I'll see what I can do to help.
 
It's none of those.

I'm using the reportviewer control in VB 2005 with local report /
reportembeddedresource of a .rdlc extension.


Here's a little bit of the code for when the reportviewer completes loading:

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

ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
ReportViewer1.PrintDialog()

If Windows.Forms.DialogResult.Cancel Then
frmInvoices.Show()
Me.Close()
End If

Catch ex As Exception

End Try
End Sub

Thanks!
 
Back
Top