Sending text to the printer
-
I'm trying to have my program display the PrintDialog and then print out some text. I assumed it would work similar to the open and save dialogs but when I try to double click on the printdialog it refuses to produce an event for when the person clicks the print button. Can someone explain what is going wrong and how I can print a string of text. thanks Mike
-
I'm trying to have my program display the PrintDialog and then print out some text. I assumed it would work similar to the open and save dialogs but when I try to double click on the printdialog it refuses to produce an event for when the person clicks the print button. Can someone explain what is going wrong and how I can print a string of text. thanks Mike
You need a printdialog and a printdocument. When printdialog's dialogresult=okay use
printdocument.print
to call the printdocument.printpage-event. There you have to use graphics.drawstring-method to print your string."I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
-
You need a printdialog and a printdocument. When printdialog's dialogresult=okay use
printdocument.print
to call the printdocument.printpage-event. There you have to use graphics.drawstring-method to print your string."I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
Thank you for your help. But I have a follow up question, when I double click on the printdocument I dragged and dropped into the program it creates a subroutine. However, when I run the program and click the print button of the printdialog it doesn't trigger the event. What is the event that the print button triggers? thanks again, Mike
-
Thank you for your help. But I have a follow up question, when I double click on the printdocument I dragged and dropped into the program it creates a subroutine. However, when I run the program and click the print button of the printdialog it doesn't trigger the event. What is the event that the print button triggers? thanks again, Mike
printdialog1.document = printdocument1 if printdialog1.showdialog = dialogresult.ok then printdocument1.printpage
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
-
printdialog1.document = printdocument1 if printdialog1.showdialog = dialogresult.ok then printdocument1.printpage
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
-
Thank you again for your help. But I still don't know what event this code goes into because the printdocument1.printpage event isn't triggered and printdialogs don't appear to allow events. thanks, Mike
You put a button somewhere on your form that is usually labeled "print". Put the code in this button's click-event. This is very basic stuff, you really should get a book, if you don't know how to do that.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)