By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

printing error when printing a image....

P: n/a
Hi, I am getting this error within when i try and print to a printer...

"Value cannot be null."

the line "e.Graphics.DrawImage9me.PictireBox1.Image,0,0 )" is highlighted.

My code below...

Imports System.Drawing.Image
Imports System.Drawing.PointF

Imports System.Drawing.Printing.PrintPageEventArgs

Imports System.Drawing.Printing.PrintDocument

Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click

Dim PrintDialog1 As New PrintDialog

PrintDialog1.Document = PrintDocument1

Dim r As DialogResult = PrintDialog1.ShowDialog

If r = DialogResult.OK Then


End If

End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

e.Graphics.DrawImage(Me.PictureBox1.Image, 0, 0)

e.HasMorePages = False

End Sub

can anyone suggest why this is happening?? and how to fix it.


Nov 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.