G
Guest
The Print() method used in my vb .net 2003 program abort with a
"Descripteur non valide" and i don't know why.
Following the part of my code :
Friend WithEvents Papier As System.Drawing.Printing.PrintDocument
Me.Papier = New System.Drawing.Printing.PrintDocument
Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdPrint.Click
Try
Papier.Print()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Problème d'impression
!")
End Try
End Sub
Private Sub Papier_PrintPage(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles Papier.PrintPage
e.Graphics.DrawString(Me.Text, New Font("Helvetica narrow", 12,
FontStyle.Bold), Brushes.Black, 160, 4)
e.Graphics.DrawString("Section", New Font("Helvetica narrow", 10,
FontStyle.Bold), Brushes.Black, 14, 50)
e.Graphics.DrawString("Rubrique", New Font("Helvetica narrow", 10,
FontStyle.Bold), Brushes.Black, 180, 50)
......
"Descripteur non valide" and i don't know why.
Following the part of my code :
Friend WithEvents Papier As System.Drawing.Printing.PrintDocument
Me.Papier = New System.Drawing.Printing.PrintDocument
Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdPrint.Click
Try
Papier.Print()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Problème d'impression
!")
End Try
End Sub
Private Sub Papier_PrintPage(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles Papier.PrintPage
e.Graphics.DrawString(Me.Text, New Font("Helvetica narrow", 12,
FontStyle.Bold), Brushes.Black, 160, 4)
e.Graphics.DrawString("Section", New Font("Helvetica narrow", 10,
FontStyle.Bold), Brushes.Black, 14, 50)
e.Graphics.DrawString("Rubrique", New Font("Helvetica narrow", 10,
FontStyle.Bold), Brushes.Black, 180, 50)
......