473,387 Members | 1,624 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,387 software developers and data experts.

PrinterSettings

I am having problems using the Printer Dialog to set PrinterSettings,
specifically the landscape property of the DefaultPageSettings. Here's the
code:

<code>
Private Sub GetPrinter(ByRef PrinterSettings as PrinterSettings, Landscape
as Boolean)
Dim pdiag As New PrintDialog
Dim pset As New PrinterSettings
pset.DefaultPageSettings.Landscape = Landscape
pdiag.PrinterSettings = pset
If pdiag.ShowDialog() = DialogResult.OK Then
PrinterSettings = pdiag.PrinterSettings
End If
End Sub
</code>

Regardless of what printer and/or options are selected in the dialog, they
aren't in pdiag.PrinterSettings. Am I doing something wrong? Shouldn't the
options selected be in pdiag.PrinterSettings?

Thanks


Jul 21 '05 #1
3 4911
Hi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have set printer properties in
the printer dialog, the configurations cannot be seen from PrinterSettings
property. If there is any misunderstanding, please feel free to let me know.

I have tried your code and call the sub with the following code:

Dim p As New PrinterSettings
GetPrinter(p, True)

It works well on my computer, the setting that I made in the dialog box can
be get from p successfully. If that doesn't work, could you show me more
code when you call that sub? Or is my understanding to this issue correct?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
Hi,

Based on my research, if you need to make changes to the printer settings,
you need to change the DefaultPageSettings property of a PrinterDocument
instead of the PrintDialog.PrinterSettings. Here I have made some changes
to your code. It is not recommended to use PrinterSettings as the parameter
name, because it as the name of a class.

Private Sub GetPrinter(ByRef PrinterSetting As PrinterSettings, ByVal
Landscape As Boolean)
Dim pdiag As New PrintDialog
Dim pset As New PrinterSettings
Dim doc As New PrintDocument
pdiag.Document = doc
pdiag.Document.DefaultPageSettings.Landscape = Landscape
If pdiag.ShowDialog() = DialogResult.OK Then
PrinterSetting = pdiag.PrinterSettings
End If
End Sub

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3
Hi,

This all helped me to solve a problem that I had saving and restoring
printer settings. Except that PrinterSettings has a member
DefaultPageSettings which is not being used.

I dont understand why modifying or assigning Document.PrinterSettings or
pdiag.Document.PrinterSettings
before the dialog does not change the PageSettings to the those in the
Document.PrinterSettings.DefaultPageSettings.

Why do we instead have to assign the page part of what appeard to be an
ecapsulated set of printter settings separately into
Document.DefaultPageSettings.

"Steve Hanna" wrote:
That did it.

Thanks

Steve

"Kevin Yu [MSFT]" wrote:
Hi,

Based on my research, if you need to make changes to the printer settings,
you need to change the DefaultPageSettings property of a PrinterDocument
instead of the PrintDialog.PrinterSettings. Here I have made some changes
to your code. It is not recommended to use PrinterSettings as the parameter
name, because it as the name of a class.

Private Sub GetPrinter(ByRef PrinterSetting As PrinterSettings, ByVal
Landscape As Boolean)
Dim pdiag As New PrintDialog
Dim pset As New PrinterSettings
Dim doc As New PrintDocument
pdiag.Document = doc
pdiag.Document.DefaultPageSettings.Landscape = Landscape
If pdiag.ShowDialog() = DialogResult.OK Then
PrinterSetting = pdiag.PrinterSettings
End If
End Sub

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #4

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

Similar topics

3
by: RBisch | last post by:
I am finding that some of the properties off of the PrinterSettings object are misleading For example, When I test the CanDuplex on a printer I know duplexes, the property is false. Another one...
1
by: Richard Golebiowski | last post by:
I have been trying to figure this out for quite some time and cannot find any examples in VB.Net or in VB that work correctly. I am working on an application where I want the user to be able to...
3
by: Jochen Kalmbach | last post by:
Hello, if an PrinterSettings-Instance is not set-up correctly (for example just by using the default-constructor), then the "ToString()"_method will throw an exception! Unhandled...
2
by: Robert Hooker | last post by:
Hi, I'm curious to know if I'm doing something wrong here, or if this is just mind-numbingly slow for a reason. In a simple WindowsFormsApplication: public Form1() { // Required for...
1
by: Sachin | last post by:
I have multiple printer drivers installed (e.g. EPSON, RICOH, CANNON) on my computer. Is there any way to check/get the PrinterSettings of any of them using Printer Name? i.e. if I want to check...
0
by: trint | last post by:
try { // Wait for the report to completely render. if(m_numberOfPages < 1) return false; PrinterSettings printerSettings = new PrinterSettings(); printerSettings.MaximumPage = m_numberOfPages;...
3
by: Steve Hanna | last post by:
I am having problems using the Printer Dialog to set PrinterSettings, specifically the landscape property of the DefaultPageSettings. Here's the code: <code> Private Sub GetPrinter(ByRef...
2
by: Tessa | last post by:
Hi, We have a .net web application, and are trying to use PrinterSettings.InstalledPrinters to list the printers installed on the webserver. (Windows 2003 server R2, IIS 6, .net framework 2.0.)...
2
by: =?Utf-8?B?RGF2aWQ=?= | last post by:
I’m not sure how to feed PCL commands (i.e. “Ec&l1S”) thru the PrinterSettings() function, but we have been successfully using the PrinterSetting() properties and methods to successfully call...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.