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 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 :'(

Be a part of the DaniWeb community

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