im making insert update and delete with database for my activity and the teacher give task to add print and im trying to make on my own but its diffucult for me i hope you can help me out with these. im beginner at visual basic. im using printdocument and printpreviewdialog Here my code Print button
Private Sub btnprint_Click(sender As Object, e As EventArgs) Handles btnprint.Click
Dim PrintPreview As New PrintPreviewDialog
PrintPreview.Document = PrintDocument1
PrintPreview.ShowDialog()
End Sub
Print Document Print Page
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim H As Integer = 0
H = 50
e.Graphics.DrawString("PRINT", New Drawing.Font("Times New Roman", 10), Brushes.Black, 50, H)
For Each Itm As ListViewItem In ListView1.Items
e.Graphics.DrawString(Itm.Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 50, H)
e.Graphics.DrawString(Itm.SubItems(0).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(1).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(2).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(3).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(4).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(5).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(6).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(7).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(8).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(9).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
H += 20
Next
End Sub
here's my ouput Output