Question graphics isn't declared

MikeSmithh

New member
Joined
Dec 10, 2013
Messages
2
Programming Experience
1-3
im studying computer studies and the coding we are using is vb.net and during my coursework I need to be able to print a file off. Ive got all of the coding correct but there Is one error in it, the coding that I creating the error is this :
e.graphics.drawstring("My Spelling List", printheading, Brushes.Black, 250, 50)

the error is graphics isn't declared but im not sure what to declare it as, any help?
 
'e' is the second parameter in pretty much all event handlers, where the first parameter is 'sender'. The first parameter is the object that raised the event and the second parameter is the event data provided by the sender. The 'e' parameter is either type EventArgs or some type that inherits EventArgs. The actual type depends on the event and, therefore, what members it has also depends on the event. If you want to print then you need to handle the PrintPage event of a PrintDocument. In the handler for that event, 'e' is type PrintPageEventArgs and will therefore have a Graphics property. If there's no Graphics property in your case, it is because you're handling the wrong event.
 
Back
Top