[RESOLVED] [2008]How can I prevent from the user to print from PrintPreviewDialog
Hi,
I am using the code below:
Code:
Dim PPD As New PrintPreviewDialog
PPD.WindowState = FormWindowState.Maximized
PPD.Document = PrintDocument1
PPD.ShowDialog()
When the PrintPreviewDialog show the Document, the user can print the Document.
How can I prevent from the user to print from PrintPreviewDialog?
Re: [2008]How can I prevent from the user to print from PrintPreviewDialog
This is a bit confusing.
You are presenting the print preview dialog to the user, but you don't want the user to use it - is that what is happening here?
If so, then why are you displaying it in the first place? What is it that you do want the user to do?
Re: [2008]How can I prevent from the user to print from PrintPreviewDialog
Hi,
I want that the user will print from another place (button), because the program needs to save some data before printing.
Re: [2008]How can I prevent from the user to print from PrintPreviewDialog
The PrintPreviewDialog control contains a ToolStrip which has the printToolStripButton among other ToolStripItems. So what you need to do is to get a reference to the printToolStripButton and set its enable property to false prior to showing the printpreviewdialog. Something like this
Code:
For Each ctrl As Control In PrintPreviewDialog1.Controls
If TypeOf ctrl Is ToolStrip Then
For Each item As ToolStripItem In DirectCast(ctrl, ToolStrip).Items
If item.Name = "printToolStripButton" Then
item.Enabled = False
End If
Next
End If
Next
PrintPreviewDialog1.Show()
Re: [2008]How can I prevent from the user to print from PrintPreviewDialog
Hi,
Great Great Great !!!
Thank you very much