473,379 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

printing error when printing a image....

Hi, I am getting this error within vb.net 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

PrintDocument1.Print()

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.

Thanks,

Gary
Nov 22 '05 #1
0 1035

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gary | last post by:
Hi, I am getting this error within vb.net 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...
1
by: Frank.Sebesta | last post by:
I have a employees database with a picture that shows on a form with employee information. Similar to the Northwinds sample database. When I print the record, my output is only the data and does...
5
by: Senthil Kumar | last post by:
hi Group, Iam developing one Component in c#.It will load any kind of image either from Local machine or URL.Finally I do have options for printing and preview. While printing Iam facing the...
5
by: VMI | last post by:
I have a BMP image (the form is also in PDF) that contains a scanned copy of a paper form that we need to fill out. Is it possible to use this image in my application so that the application can...
2
by: Stephen Wolfman | last post by:
I'm rendering an RS report into an image programmatically before printing (using System.Drawing.Printing) it, but it always renders the image based upon the screen resolution of the server that my...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
4
by: Prakash | last post by:
I'm developing an HR package which would contain the Employees Photo + upto 3 pages (pictures) of his Passport + pictures of his Driving License and Residence Card. If the user wants to print...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
0
by: ben.agnoli | last post by:
I have written the below class for printing out large jpg files (1 page wide, multiple pages high) over multiple pages. The class will get instantiated multiple times at once by a windows service....
0
by: gnewsgroup | last post by:
In my asp.net 2.0 web application. I create chart images on the fly by getting the data from the database. These chart images all have fixed width, but the height is dynamic depending on the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.