Private Sub Buttonprint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonprint.Click
PrintDialog1.Document = PrintDocument1 'PrintDialog associate with PrintDocument.
If PrintDialog1.ShowDialog() = DialogResult.OK Then
PrintDocument1.Print()
End If
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.DrawString(TextBox1.Text,TextBox1.Font, Brushes.Black, 100, 100)
e.Graphics.PageUnit = GraphicsUnit.Inch
End Sub
Private Sub btnPrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
PrintPreviewDialog1.Document = PrintDocument1 'PrintPreviewDialog associate with PrintDocument.
PrintPreviewDialog1.ShowDialog()
End Sub