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
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Just Me,
Today real confusing questions.
I may assume that PageSetupDialog is a windows.forms.form?
And please do not use "With" in your questions, it makes reading messages
very confusing, use just short names in your sample by instance when the
sentence above is true, frm1.
However I think that when above is true it can be.
\\\
dim frm1 as new form1
frm1.Document = mPD
If frm1.showDialog() <> DialogResult.OK then
mPD = frm.Document
etc
Else
'do what has to be done when it is not OK
End if
frm1.dispose
///
I hope this helps?
Cor
Cor
" Just Me" <gr****@a-znet.com> schreef in bericht
news:O6*************@TK2MSFTNGP11.phx.gbl... Dim PageSetupDialog As New PageSetupDialog
With PageSetupDialog
.Document = mPD
...snip
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
It does not reflect the change.
Would you expect it to and if so do you have a suggestion as to what
might be wrong?
I wonder should I use(this does not fix the problem):
Dim PageSetupDialog As New PageSetupDialog
With PageSetupDialog
.Document = mPD
.PrinterSettings = mPD.DefaultPageSettings.PrinterSettings
.PageSettings = mPD.DefaultPageSettings ...snip
If .ShowDialog() <> DialogResult.OK Then Exit Sub
End With
Forgot to innclude the ending in the first post