printing causes form to close

I have a strange error. When I print to a printer, it causes the form to close.

here is the code:

Private Sub PrintALabel()

Me.printdoc = New PrintDocument
Me.printdoc.Print() ' This line cause the form to close

End Sub
Private Sub printdoc_printpage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles printdoc.PrintPage

Dim XDate As Date = Now()
Dim pfont12 As Font = New Font("Arial", 12)
Dim pfont10 As Font = New Font("Arial", 10)

commenting out the Me.printdoc.Print line makes the form stay open but nothing prints naturally.
Anyone know what causes this behavior, and how to prevent it?

Thanks, Art
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!