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"Cuji lO8C4^r,6rco%?. Xk?;y`M?j&$Pmm> %[c!9kDW7m]C~N
bWutCC$vPTUW-"icn`nX:[F"N;mB9}]ABU?Y]tZwmSP{]!
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Date: Wed, 17 Sep 2003 22:59:37 -0700
| NNTP-Posting-Host: 217.7.150.245
| Lines: 1
| Path:
cpmsftngxa06.ph x.gbl!TK2MSFTNG XA06.phx.gbl!TK 2MSFTNGXA05.phx .gbl!TK2MSFTNGP 0
8.phx.gbl!TK2MS FTNGP11.phx.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1857 06
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.Argument Exception: The value '0' is not a
| >| valid value for the enum 'Duplex'.
| >|
| >| at
| >| System.Componen tModel.EnumConv erter.ConvertTo (ITypeDescripto rContext
| >| context, CultureInfo culture, Object value, Type
| >| destinationType )
| >| at System.Componen tModel.TypeConv erter.ConvertTo String(Object
| >| value) at System.Drawing. Printing.Printe rSettings.ToStr ing()
| >| at PrinterSettings Bug_CS.Class1.M ain(String[] args)
| >|
| >|
| >| Here is a simple example to reproduce the problem:
| >|
| >| <code>
| >| namespace PrinterSettings Bug_CS
| >| {
| >| class Class1
| >| {
| >| [System.STAThrea d]
| >| static void Main(string[] args)
| >| {
| >| System.Drawing. Printing.Printe rSettings ps = new
| >| System.Drawing. Printing.Printe rSettings();
| >|
| >| System.Console. WriteLine(ps.To String()); // <===== Exception
| >| *****
| >
| >| }
| >| }
| >| }
| >| </code>
|
| --
| Greetings
| Jochen
|
| Do you need a memory-leak finder ?
|
http://www.codeproject.com/tools/leakfinder.asp
|