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

BUG: PrinterSettings.ToString()

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 Exception: System.ArgumentException: The value '0' is not a
valid value for the enum 'Duplex'.

at System.ComponentModel.EnumConverter.ConvertTo(ITyp eDescriptorContext
context, CultureInfo culture, Object value, Type destinationType)
at System.ComponentModel.TypeConverter.ConvertToStrin g(Object value)
at System.Drawing.Printing.PrinterSettings.ToString()
at PrinterSettingsBug_CS.Class1.Main(String[] args)
Here is a simple example to reproduce the problem:

<code>
namespace PrinterSettingsBug_CS
{
class Class1
{
[System.STAThread]
static void Main(string[] args)
{
System.Drawing.Printing.PrinterSettings ps = new
System.Drawing.Printing.PrinterSettings();

System.Console.WriteLine(ps.ToString()); // <===== Exception *****
}
}
}
</code>

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp
Nov 15 '05 #1
3 2635

Hi Jochen,

What is the version of your VS.NET and .Net Framework?
I have tried your code, but no exception generated.
My VS.net IDE is 2003 Version 7.1.3088, .Net Framework is 1.1
Version 1.1.4322

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Subject: BUG: PrinterSettings.ToString()
| From: Jochen Kalmbach <no********************@holzma.de>
| Message-ID: <Xn*********************************@127.0.0.1>
| User-Agent: Xnews/5.04.25
| X-Face:
#TA[Jae"bdx-+QGJx=d8Gi"CujilO8C4^r,6rco%?.Xk?;y`M?j&$Pmm>%[c!9kDW7m]C~N
bWutCC$vPTUW-"icn`nX:[F"N;mB9}]ABU?Y]tZwmSP{]!
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Date: Wed, 17 Sep 2003 05:41:41 -0700
| NNTP-Posting-Host: 217.7.150.245
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:185455
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| 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 Exception: System.ArgumentException: The value '0' is not a
| valid value for the enum 'Duplex'.
|
| at System.ComponentModel.EnumConverter.ConvertTo(ITyp eDescriptorContext
| context, CultureInfo culture, Object value, Type destinationType)
| at System.ComponentModel.TypeConverter.ConvertToStrin g(Object value)
| at System.Drawing.Printing.PrinterSettings.ToString()
| at PrinterSettingsBug_CS.Class1.Main(String[] args)
|
|
| Here is a simple example to reproduce the problem:
|
| <code>
| namespace PrinterSettingsBug_CS
| {
| class Class1
| {
| [System.STAThread]
| static void Main(string[] args)
| {
| System.Drawing.Printing.PrinterSettings ps = new
| System.Drawing.Printing.PrinterSettings();
|
| System.Console.WriteLine(ps.ToString()); // <===== Exception *****

| }
| }
| }
| </code>
|
| --
| Greetings
| Jochen
|
| Do you need a memory-leak finder ?
| http://www.codeproject.com/tools/leakfinder.asp
|

Nov 15 '05 #2
Jeffrey Tan[MSFT] wrote:
What is the version of your VS.NET and .Net Framework?
I have tried your code, but no exception generated.
My VS.net IDE is 2003 Version 7.1.3088, .Net Framework is 1.1
Version 1.1.4322
I have the same:
VS.NET IDE is 2003 Version 7.1.3088
..NET Frameworrk Version 1.1.4.4322

And the problem really happens...

Greetings
Jochen

| Unhandled Exception: System.ArgumentException: The value '0' is not a
| valid value for the enum 'Duplex'.
|
| at
| System.ComponentModel.EnumConverter.ConvertTo(ITyp eDescriptorContext
| context, CultureInfo culture, Object value, Type
| destinationType)
| at System.ComponentModel.TypeConverter.ConvertToStrin g(Object
| value) at System.Drawing.Printing.PrinterSettings.ToString()
| at PrinterSettingsBug_CS.Class1.Main(String[] args)
|
|
| Here is a simple example to reproduce the problem:
|
| <code>
| namespace PrinterSettingsBug_CS
| {
| class Class1
| {
| [System.STAThread]
| static void Main(string[] args)
| {
| System.Drawing.Printing.PrinterSettings ps = new
| System.Drawing.Printing.PrinterSettings();
|
| System.Console.WriteLine(ps.ToString()); // <===== Exception
| *****

| }
| }
| }
| </code>


--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp
Nov 15 '05 #3

Hi ,

Have you overrided the ToString method of PrinterSettings?
If not, have you tried this code on other machines?

It is strange that I have tried your code on my 3 colleagues' machine and
all work well. (their VS.net also version 2003 Framework 1.1)

Best regards,
Beste
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Subject: RE: BUG: PrinterSettings.ToString()
| From: Jochen Kalmbach <no********************@holzma.de>
| References: <Xn*********************************@127.0.0.1>
<KY**************@cpmsftngxa06.phx.gbl>
| Message-ID: <Xn*********************************@127.0.0.1>
| User-Agent: Xnews/5.04.25
| X-Face:
#TA[Jae"bdx-+QGJx=d8Gi"CujilO8C4^r,6rco%?.Xk?;y`M?j&$Pmm>%[c!9kDW7m]C~N
bWutCC$vPTUW-"icn`nX:[F"N;mB9}]ABU?Y]tZwmSP{]!
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Date: Wed, 17 Sep 2003 22:59:37 -0700
| NNTP-Posting-Host: 217.7.150.245
| Lines: 1
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFT NGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:185706
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Jeffrey Tan[MSFT] wrote:
|
| > What is the version of your VS.NET and .Net Framework?
| > I have tried your code, but no exception generated.
| > My VS.net IDE is 2003 Version 7.1.3088, .Net Framework is 1.1
| > Version 1.1.4322
|
| I have the same:
| VS.NET IDE is 2003 Version 7.1.3088
| .NET Frameworrk Version 1.1.4.4322
|
| And the problem really happens...
|
| Greetings
| Jochen
|
|
| >| Unhandled Exception: System.ArgumentException: The value '0' is not a
| >| valid value for the enum 'Duplex'.
| >|
| >| at
| >| System.ComponentModel.EnumConverter.ConvertTo(ITyp eDescriptorContext
| >| context, CultureInfo culture, Object value, Type
| >| destinationType)
| >| at System.ComponentModel.TypeConverter.ConvertToStrin g(Object
| >| value) at System.Drawing.Printing.PrinterSettings.ToString()
| >| at PrinterSettingsBug_CS.Class1.Main(String[] args)
| >|
| >|
| >| Here is a simple example to reproduce the problem:
| >|
| >| <code>
| >| namespace PrinterSettingsBug_CS
| >| {
| >| class Class1
| >| {
| >| [System.STAThread]
| >| static void Main(string[] args)
| >| {
| >| System.Drawing.Printing.PrinterSettings ps = new
| >| System.Drawing.Printing.PrinterSettings();
| >|
| >| System.Console.WriteLine(ps.ToString()); // <===== Exception
| >| *****
| >
| >| }
| >| }
| >| }
| >| </code>
|
| --
| Greetings
| Jochen
|
| Do you need a memory-leak finder ?
| http://www.codeproject.com/tools/leakfinder.asp
|

Nov 15 '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...
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...
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...
0
by: Steph. | last post by:
Hi, Is there a BUG in the printdialog ? When I create a PrintDialog ans set the "DefaultPageSettings.Landscape" property to "false" and then display the dialog, select "Landscape" and click OK,...
4
by: Steph. | last post by:
Hi, Is there a BUG in the printdialog ? When I create a PrintDialog ans set the "DefaultPageSettings.Landscape" property to "false" and then display the dialog, select "Landscape" and click OK,...
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;...
1
by: Babz | last post by:
Hi Using the PrinterSettings class I want to get the No. Of copies of the document to be printed. But it is always giving 1 as the copies to be printed. I am using following code ...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
1
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...
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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
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.