473,804 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.DefaultPage Settings.PaperS ize.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 3275
> 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.DefaultPage Settings.PaperS ize.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
..PrinterSettin gs = mPD.DefaultPage Settings.Printe rSettings
..PageSettings = mPD.DefaultPage Settings ...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.f orm?

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******** *****@TK2MSFTNG P11.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.DefaultPage Settings.PaperS ize.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
.PrinterSetting s = mPD.DefaultPage Settings.Printe rSettings
.PageSettings = mPD.DefaultPage Settings
...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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnMore.Click
Dim PageSetupDialog As New PageSetupDialog
With PageSetupDialog
..Document = mPD
'.PrinterSettin gs = mPD.DefaultPage Settings.Printe rSettings
'.PageSettings = mPD.DefaultPage Settings
..ShowHelp = False
..AllowPaper = True
..AllowMargins = True
..AllowOrientat ion = True
..AllowPrinter = True
..PageSettings. Margins.Top = 100 * Gdi.CSingle(txt TopMargin.Text)
..PageSettings. Margins.Left = 100 * Gdi.CSingle(txt LeftMargin.Text )
..PageSettings. Margins.Right = 100 * Gdi.CSingle(txt RightMargin.Tex t)
..PageSettings. Margins.Bottom = 100 * Gdi.CSingle(txt BottomMargin.Te xt)
If .ShowDialog() <> DialogResult.OK Then Exit Sub
mPD = .Document
End With
LoadTextBoxes()
RaiseEvent PageSetupChange d(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.DefaultPage Settings.PaperS ize.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******** *******@TK2MSFT NGP11.phx.gbl.. .
Just Me,

Today real confusing questions.

I may assume that PageSetupDialog is a windows.forms.f orm?

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******** *****@TK2MSFTNG P11.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.DefaultPage Settings.PaperS ize.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
.PrinterSetting s = mPD.DefaultPage Settings.Printe rSettings
.PageSettings = mPD.DefaultPage Settings
...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.PrintD ocument
Dim pgs As New PageSetupDialog
pgs.Document = New Printing.PrintD ocument
pgs.ShowDialog( )
pd = pgs.Document
MessageBox.Show (pd.DefaultPage Settings.PaperS ize.ToString)
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
InitializeCompo nent()

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.DefaultPageS ettings.PaperSi ze

Did you try that?

Thanks

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uf******** ******@tk2msftn gp13.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.PrintD ocument
Dim pgs As New PageSetupDialog
pgs.Document = New Printing.PrintD ocument
pgs.ShowDialog( )
pd = pgs.Document
MessageBox.Show (pd.DefaultPage Settings.PaperS ize.ToString)
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.GetDeviceCa ps(hdc, GDI.PHYSICALHEI GHT)
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******** ********@TK2MSF TNGP11.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
InitializeCompo nent()

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.DefaultPageS ettings.PaperSi ze

Did you try that?

Thanks

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uf******** ******@tk2msftn gp13.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.PrintD ocument
Dim pgs As New PageSetupDialog
pgs.Document = New Printing.PrintD ocument
pgs.ShowDialog( )
pd = pgs.Document
MessageBox.Show (pd.DefaultPage Settings.PaperS ize.ToString)
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
1179
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, _ ByVal e As System.EventArgs) Handles btnPageSetup.Click '--- If Microsoft fix the bug should be: 'PageSetupDialog1.PageSettings = PrintPageSettings
1
1426
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 PrintDocument = New PrintDocument
0
1050
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 not always get the correct results. Expertimenting isn't getting me anywhere I need someone who understands the mPD options! I know I can also get page size by zz = mpD.PrinterSettings.DefaultPageSettings.PaperSize.Height
2
4900
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 group border title), click on the OK button, and then open the dialog box again, I find that all the margin values were divided by 2.54. Basically, every time I open that Dialog box and click on OK, all the margin values get divided by 2.54. I...
1
2619
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 close the PageSetupDialog or PrintDialog. This doesn't happen if the Windows Form is displayed using the Show method. Does anyone have a solution? I've made my own Print Setup Dialog Box (frmPrint). I've added the PrintDocument, PageSetupDialog...
1
3902
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 selection in papersize dropdown. Is it possible to customize this option?? /Ratan
1
4834
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 apparently not-initialized properly. It appears to be printing to a very small page size and only prints a small piece of each page. Alternatively, if if a user selects the new printer, then user selects the paper size from the printer properties,...
0
1895
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 I close and reload it. How do I enable these changes to immediately show up in the print preview. See Code Below. Paul Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object,
0
1136
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 PaperSize in PageSetupDialog And result OK; source code: private void button2_Click(object sender, EventArgs e) { pd = new PrintDocument(); PageSetupDialog mPS = new PageSetupDialog(); foreach...
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.