Dear All,

I hope you all would be fine please help me in printing i want to take print preview of window form and after taking print preview want to take print of form how can i do this please provide me example.

Thanks in advance

7 Years
Discussion Span
Last Post by Teme64

i am using this code but it does not generate the preview of window form in vb.net code is as follows:

Dim printDialog1 As PrintDialog = New PrintDialog
        Dim printPreviewDialog1 As New PrintPreviewDialog()
        printDialog1.Document = PrintDocument1
        Dim result As DialogResult = printDialog1.ShowDialog
        If (result = DialogResult.OK) Then
        End If

Please help


For some reason I failed to get that print preview to work :@

I noticed that your code needed to bind PrintDocument to PrintPreviewDialog before showing the dialog. Also the source of data and rendering were missing but I bet you have code for that. I started to use MSDN documentation PrintPreviewDialog Class, but so far it's not working. I suggest taking a look at that documentation, you may spot something that I missed. And one thing that's confusing was InitializePrintPreviewDialog method mentioned in the MSDN which I didn't manage to locate :-O

i think it is included in visual studio 2008

You're right. No separate download needed for printing anymore :)

Anyway, sorry that I couldn't help you any better after getting totally stuck myself :'(

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.