Solved

Common dialog problem

Posted on 2000-03-01
2
156 Views
Last Modified: 2010-05-02
Hi i am using the commondialog control to do a simple print of a form. I am using vb6 service pack 3

now when i display the print dialog box with, if i press cancel, it still sends the job to the printer, how can i stop it from going to the print que and get the cancel to work properly

thanx in advance

:)

CRaig
0
Comment
Question by:CraigLazar
2 Comments
 
LVL 2

Accepted Solution

by:
p_biggelaar earned 30 total points
Comment Utility
Make sure you set CancelError to true

Either use On error resume next or On error goto to trap errornumber 32755 (Cancel selected)

Example:

CommonDialog1.CancelError = True
On Error Resume Next

CommonDialog1.ShowPrinter
If Err = 32755 Then 'Cancel pressed
  'Do what you want, but don't print
Elseif Err=0 then
  'Print
Else
  'There was another error
End If

I admit the example is not the recommended way to program, but it is meant to give you an idea of how to determine that Cancel was pressed.
0
 
LVL 4

Author Comment

by:CraigLazar
Comment Utility
Thanx
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now