Using a Common Dialog Box to Print Contents of Various Controls
Posted on 2001-08-24
I am trying to print the contents of a RichTextBox using a Windows Common Dialog Box component.
It works to print, if I select OK. If I select Cancel the program crashes with a run-time error #32755.
The name of the common dialog box is 'cmdEd'. It was coded by another developer, without comments, to print the contents of the rtfDisplay RichTextBox control.
The code is as follows:
cdgEd.Flags = cdlPDReturnDC + cdlPDNoPageNums
If rtfDisplay.SelLength = 0 Then
cdgEd.Flags = cdgEd.Flags + cdlPDAllPages
cdgEd.Flags = cdgEd.Flags + cdlPDSelection
I presently don't understand these 'Flags'. I know how to code the vbOKOnly or vbCancel on a message box.
How does one properly code this dialog component to insure that clicking on cancel truly does cancel and unload the dialog?