I want to use the printPreviewDialog control to view the print preview of a document.
I am using this code

Dim oPD As New PrintDocument
oPD.DocumentName = TextBox1.Text
PrintPreviewDialog1.PrintPreviewControl.Document = oPD
PrintPreviewDialog1.ShowDialog()

TextBox1 contains the file name to be opened with print preview control. Problem is that it only show the empty print preview control . If someone can tell me what's wrong with my code. I am using vb.net.

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.