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

i think it is included in visual studio 2008

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()
        printPreviewDialog1.ShowDialog()
        printDialog1.Document = PrintDocument1
        Dim result As DialogResult = printDialog1.ShowDialog
        If (result = DialogResult.OK) Then
            PrintDocument1.Print()
        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 :'(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.