|
-
Dec 23rd, 1999, 07:50 PM
#1
Thread Starter
Addicted Member
Hello!!!
Some questions about the commondialog control's print dialog:
1. How can I let the user to choose the start page and the end page?
2. How can I let the user to choose if he/she wants to collate the pages in the case of multiple copies?
3. How can I use the print dialog to select a printer and then set the crystalreports control to print to this printer?
Thanks!!!
-
Dec 24th, 1999, 01:19 AM
#2
Here is part of the answer:
Code:
Private Sub Command1_Click()
Dim BeginPage As Integer
Dim EndPage As Integer
Dim NumCopies As Integer
Dim Orientation As Integer
Dim Ndx As Integer
' Set Cancel to True.
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' Display the Print dialog box.
CommonDialog1.ShowPrinter
' Get user-selected values from the dialog box.
BeginPage = CommonDialog1.FromPage
EndPage = CommonDialog1.ToPage
NumCopies = CommonDialog1.Copies
Orientation = CommonDialog1.Orientation
For Ndx = 1 To NumCopies
' Put code here to send data to your printer.
Next
Exit Sub
ErrHandler:
' User pressed Cancel button.
Exit Sub
End Sub
------------------
Marty
-
Dec 25th, 1999, 02:08 AM
#3
Thread Starter
Addicted Member
Hello again!!!
Actually what I mean was, that when I call to the ShowPrinter method of the commondialog control, I get these options (StartPage, EndPage and Collate) hidden or disabled. I want to know how I can make them enabled and visible so the user can change their values.
I also want to know how I can get the printer's name and the driver's name from the commondialog control.
Thanks!!!
-
Dec 29th, 1999, 02:29 AM
#4
New Member
When you use the common dialog's showprinter method, any change to the currently selected printer automatically updates the Printer object within VB. To change the printer when printing a CR report, use the report's SelectPrinter method and assign the required Printer properties to the SelectPrinter arguments.
Here are the 3 lines of code you need:
cdMain.ShowPrinter
rptBlotter.SelectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port
rptBlotter.PrintOut False
-
Dec 29th, 1999, 02:49 AM
#5
Thread Starter
Addicted Member
Thank you very much for your code!!!
But still, Does anyone know how to enable the start page, end page and collate options?
-
Dec 29th, 1999, 05:18 PM
#6
Fanatic Member
Play around with these constants:
cdlPDNoPageNums
cdlPDPageNums
cdlPDCollate
I'm not sure how they work (I know that you have to use them with CommonDialog.Flags Property). I'm not going to try it now because it is 5:15 in the morning and I have to get some sleep now. Hope I was helpful.
Regards QWERTY
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.
-
Dec 29th, 1999, 10:09 PM
#7
QWERTY is right. You would have to use these constants with Flags property:
Code:
Private Sub Command1_Click()
With CommonDialog1
.Flags = cdlPDNoPageNums Or cdlPDPageNums Or cdlPDCollate
.ShowPrinter
End With
End Sub
Check out VB's help or MSDN library for complete explanation of these constants.
------------------
Serge
Software Developer
[email protected]
ICQ#: 51055819
-
Jun 4th, 2001, 02:06 PM
#8
Selecting pages
Forrest Dragon
I have the same problem as you. I want to enable the option button for selecting the printing from page to page. Did you ever solve the problem?
Jorgen
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
|