473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

using PageSetupDialog

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?

Thanks


Nov 21 '05 #1
6 3247
> 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
Nov 21 '05 #2
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

Nov 21 '05 #3
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


Nov 21 '05 #4
Just Me,

I was thinking inanother direction however is this not a nicer sample to
show what you want?
\\
Public Class main
Public Shared Sub main()
Dim pd As New Printing.PrintDocument
Dim pgs As New PageSetupDialog
pgs.Document = New Printing.PrintDocument
pgs.ShowDialog()
pd = pgs.Document
MessageBox.Show(pd.DefaultPageSettings.PaperSize.T oString)
End Sub
End Class
///

For me this works as I suspect

I hope this helps something

Cor
Cor
Nov 21 '05 #5
I wasnt sure what the easiest way to run your code is.
I made a new solution/project and inserted the guts of your code after
InitializeComponent()

Seemed to work OK at first.
Then I tried selecting "Custom" and picked new sizes.
Your code works like mine. That is, the picked sizes are not returned in
pd.DefaultPageSettings.PaperSize

Did you try that?

Thanks

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
Just Me,

I was thinking inanother direction however is this not a nicer sample to
show what you want?
\\
Public Class main
Public Shared Sub main()
Dim pd As New Printing.PrintDocument
Dim pgs As New PageSetupDialog
pgs.Document = New Printing.PrintDocument
pgs.ShowDialog()
pd = pgs.Document
MessageBox.Show(pd.DefaultPageSettings.PaperSize.T oString)
End Sub
End Class
///

For me this works as I suspect

I hope this helps something

Cor
Cor

Nov 21 '05 #6
FYI
PaperHeight = GDI.GetDeviceCaps(hdc, GDI.PHYSICALHEIGHT)
returns the correct custom sizes.
Guess the problem is the printer driver and PageSetupDialog do not correctly
up grade the custom size


" Just Me" <gr****@a-znet.com> wrote in message
news:OG****************@TK2MSFTNGP11.phx.gbl...
I wasnt sure what the easiest way to run your code is.
I made a new solution/project and inserted the guts of your code after
InitializeComponent()

Seemed to work OK at first.
Then I tried selecting "Custom" and picked new sizes.
Your code works like mine. That is, the picked sizes are not returned in
pd.DefaultPageSettings.PaperSize

Did you try that?

Thanks

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
Just Me,

I was thinking inanother direction however is this not a nicer sample to
show what you want?
\\
Public Class main
Public Shared Sub main()
Dim pd As New Printing.PrintDocument
Dim pgs As New PageSetupDialog
pgs.Document = New Printing.PrintDocument
pgs.ShowDialog()
pd = pgs.Document
MessageBox.Show(pd.DefaultPageSettings.PaperSize.T oString)
End Sub
End Class
///

For me this works as I suspect

I hope this helps something

Cor
Cor


Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andy Sze | last post by:
Visual Studio.net 2003 no yet fix the PageSetupDialog bug. http://support.microsoft.com/?id=814355 Here is my new solution: Private Sub btnPageSetup_Click(ByVal sender As System.Object, _...
1
by: Mika M | last post by:
Hi! I have some problems with setting PrintDocument margins using PageSetupDialog. Here some code to explain my problem... First PrintDocument declaring this way... Private pd As...
0
by: Just Me | last post by:
I do the code at the bottom of this, and later use: zz = mPD.DefaultPageSettings.PaperSize.Height and it works most of the time. It's a long story but if I use the printer's "Custom" size I do...
2
by: Amjad | last post by:
I use the PageSetupDialog box to allow the user to change the page margins before printing. The problem is when I open the dialog box and type in margin values in millimeters (as it says in the...
1
by: Blaine | last post by:
When I show my Windows Form as a dialog box (ShowDialog(Me)) and click on a button that calls the ShowDialog of either the PageSetupDialog or PrintDialog conrtol, my Windows Form closes After I...
1
by: Ratan | last post by:
Hello, I am using PageSetupDialog in my application to change the pagesettings of the document but i dont want to show all the page size to the user, I want to show only A3 and A4 size for...
1
by: Ed Sutton | last post by:
My C# app. apparently has problems with PageSettings not being initialized properly after calling PageSetupDialog. If a user selects a non-default printer from PageSetupDialog, the PageSize is...
0
by: ppeterkin | last post by:
I customized a PrintPreviewDialog by adding a button to it's toolstrip that opens up a PageSetupDialog. The problem is changes made to the page setup are not passed to the PrintPreviewDialog until...
0
by: ywscr | last post by:
Hello, I am using PageSetupDialog in my application to change the pagesettings of the document,I changed PaperSize To "A4" in PageSetupDialog ,But it's result PaperSize no change ??I want Set...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.