|
-
April 20th, 2001, 08:57 AM
#1
Common Dialog Control
I am using the ShowPrinter method of the common dialog control, which I thought would print my entire form. I get the printer dialog window, but I do not get anything sent to my printer. What is the trick for this to work?
-
April 20th, 2001, 09:14 AM
#2
Re: Common Dialog Control
The printer common dialog is for selecting a printer and setting various options. You will have to write your own code for doing the actual printing.
For instance, to print the entire form, use
Me.PrintForm
This will print to the printer that the user selected via your printer common dialog (or to the default printer on your system even if you don't show the printer dialog box).
To print text, you would use the Print method, whereas to print other graphics, you would use Printer.PaintPicture.
-
April 20th, 2001, 09:16 AM
#3
Re: Common Dialog Control
Is there a way to print the contents of a listbox that scrolls vertically?
-
April 20th, 2001, 09:19 AM
#4
Re: Common Dialog Control
for i = 0 to List1.ListCount-1
print List1.List(i)
next
-
April 20th, 2001, 09:34 AM
#5
Re: Common Dialog Control
This code prints to the form--not the printer. Is there a way to print the listbox contents to the printer?
-
April 20th, 2001, 09:37 AM
#6
Re: Common Dialog Control
-
April 20th, 2001, 09:58 AM
#7
Re: Common Dialog Control
There is no print method for the printer object. It only has a printquality property. Am I missing something here?
-
April 20th, 2001, 10:07 AM
#8
Re: Common Dialog Control
Though IntelliSense doesn't show it (is that a bug?), there's still a Print method for the Picturebox control and the Printer Object. So, go on with it. Only remember to put a Printer.EndDoc at the end of the loop, otherwise your application will start to print after you close your application!
-
April 20th, 2001, 10:17 AM
#9
Re: Common Dialog Control
Dim myPrinter As Printer
Dim n As Integer
Set myPrinter = Printer
For n = 0 To List1.ListCount - 1
myPrinter.Print List1.List(n)
Next
Printer.EndDoc
When I run this code, it bombs at the line myprinter.print
-
April 20th, 2001, 10:23 AM
#10
Re: Common Dialog Control
It works fine on my system. Do you have a printer installed on your system?
-
April 20th, 2001, 10:26 AM
#11
Re: Common Dialog Control
Yes, I do. I'm wondering if our network is set up in a way that prevents this from working.
Ughh!
-
April 20th, 2001, 11:24 AM
#12
Re: Common Dialog Control
Just thought you'd like to know. I took out this line of code printer = commondialog1.PrinterDefault
Now it works. I cannot understand why that hoses my printer, but I'm just happy that I can print now.
Thanks for all your help.
-
April 20th, 2001, 11:35 AM
#13
Re: Common Dialog Control
Good.
You put the PrinterDefault property to wrong use. This property returns or sets an option that determines if the user's selections in the Print dialog box are used to change the system's default printer settings.
If you included this line to tell Visual Basic to use the default printer, you do not have to. Visual Basic always uses the default printer to print unless the user chooses to print to a different printer via the print dialog box.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|