VB Code:
Dim WithEvents pdoc As Printing.PrintDocument
Private Sub pDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pDoc.PrintPage
e.Graphics.DrawString("Membership Name: " & dettxtnam.Text, New Font("Tahoma", 14), Brushes.Black, 15, 100)
e.Graphics.DrawString("Membership Number:" & dettxtnum.Text, New Font("Tahoma", 14), Brushes.Black, 15, 200)
e.Graphics.DrawString("Items List:", New Font("Tahoma", 14), Brushes.Black, 15, 300)
e.Graphics.DrawString(prodlst.Text, New Font("Tahoma", 14), Brushes.Black, 15, 400)
e.Graphics.DrawString("INVOICE", New Font("Tahoma", 15), Brushes.Black, 15, 500)
e.Graphics.DrawString("Total Before VAT: " & total.Text, New Font("Tahoma", 14), Brushes.Black, 15, 600)
e.Graphics.DrawString("VAT: " & totvat.Text, New Font("Tahoma", 14), Brushes.Black, 15, 700)
e.Graphics.DrawString("Final TOTAL " & total1.Text, New Font("Tahoma", 14), Brushes.Black, 15, 800)
End Sub
Dim PPreview As New PrintPreviewDialog
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PPreview.Document = PrintDocument1
PPreview.ShowDialog()
End Sub