Thanks, guess I didn't do a good job of describing the problem.
Below is the entire button event handler.
Because of your reply I just added the statement:
mPD = .Document
but I still do not see the effect of chosing a custom size.
Excuse the use of "With" but I did not want to change anything.
Is the mPD = .Document needed?
Should the 2 commented statements be uncommented or removed?
Private Sub btnMore_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnMore.Click
Dim PageSetupDialog As New PageSetupDialog
With PageSetupDialog
..Document = mPD
'.PrinterSettings = mPD.DefaultPageSettings.PrinterSettings
'.PageSettings = mPD.DefaultPageSettings
..ShowHelp = False
..AllowPaper = True
..AllowMargins = True
..AllowOrientation = True
..AllowPrinter = True
..PageSettings.Margins.Top = 100 * Gdi.CSingle(txtTopMargin.Text)
..PageSettings.Margins.Left = 100 * Gdi.CSingle(txtLeftMargin.Text)
..PageSettings.Margins.Right = 100 * Gdi.CSingle(txtRightMargin.Text)
..PageSettings.Margins.Bottom = 100 * Gdi.CSingle(txtBottomMargin.Text)
If .ShowDialog() <> DialogResult.OK Then Exit Sub
mPD = .Document
End With
LoadTextBoxes()
RaiseEvent PageSetupChanged(Me, Nothing)
End Sub
I call the dialog as show above.
Click on "Printer..."
Click "Properties..."
Click "Letter size" and select Custom
Then set the paper size to 8.5x12, give a name and Save
Then check mPD.DefaultPageSettings.PaperSize.Width and Height
They does not reflect the change (i.e., they are not 8.5 and 12).
Would you expect them to be 8.5 and 12?
If so do you have a suggestion as to what might be wrong?
From the doc for PageSetupDialog Class [Visual Basic]
Remarks
The PageSetupDialog dialog box modifies the PageSettings and PrinterSettings
information for a given Document. The user can enable sections of the dialog
box to manipulate printing, margins, and paper orientation, size, and source
and to show help and network buttons. MinMargins defines the minimum margins
a user can select.
THANKS