Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how can I use the printer options

Posted on 2003-02-28
3
Medium Priority
?
150 Views
Last Modified: 2011-10-03
I would like to know how can I use the printer options.

I'm using this on a commnad:

   richtextbox1.SelPrint (Printer.hDC)

This works only with the default printer and shows nothing to the user.
I have a big book on Visual Basic but it says nothing there about the commondialog printer.

Anyone who can tell me how do I use these options (printer, printer options, color, etc).
Thank You
0
Comment
Question by:igfp
3 Comments
 

Expert Comment

by:Monk246753
ID: 8040662
The ComondialogControlName.ShowPrinter

e.g.
CommonDialog1.ShowPrinter

will bring up the Windows default printer window can choose copies, colors, printers etc. There are a number of other flags to be set for different options but these can be easily found in the MSDN library.
0
 
LVL 3

Accepted Solution

by:
cmgarnett earned 100 total points
ID: 8040743
If you have a form with a RichTextBox, a CommonDialogBox and a CommandButton on it, this code allows you to print the contents of the RichTextBox to whichever printer you want.

Private Sub Command1_Click()
   
   CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums
   If RichTextBox1.SelLength = 0 Then
      CommonDialog1.Flags = CommonDialog1.Flags + cdlPDAllPages
   Else
      CommonDialog1.Flags = CommonDialog1.Flags + cdlPDSelection
   End If
   CommonDialog1.ShowPrinter
   RichTextBox1.SelPrint CommonDialog1.hDC

End Sub
0
 

Author Comment

by:igfp
ID: 8041020
Perfect! :) Thank you a lot! Exactly what I wanted to know!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question