This is the call that generates the error (in the designer generated
InitializeComponent()) :
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));

The stack calls shown when the exception is thrown :
system.drawing.dll!System.Drawing.Font::Initialize(System.Drawing.FontFa
mily family = {Name="Microsoft Sans Serif"}, float emSize = 10.0,
System.Drawing.FontStyle style = Bold, System.Drawing.GraphicsUnit unit
= Point, unsigned char gdiCharSet = 0 '', bool gdiVerticalFont = false)
+ 0x4f bytes    
system.drawing.dll!System.Drawing.Font::Font(String* familyName =
"Microsoft Sans Serif", float emSize = 10.0, System.Drawing.FontStyle
style = Bold, System.Drawing.GraphicsUnit unit = Point, unsigned char
gdiCharSet = 0 '') + 0x69 bytes 

In the System.Drawing.Font constructor the "(System.Byte)(0)" value for
gdiCharSet actually ends up as "0 ''". Is this correct? It doesn't look
right to me, I would have expected "''" or "'0'".

I am probably way off track here, I just cannot understand where this is
going wrong.

Paul Jefferies



-----Original Message-----
From: Paul Jefferies 
Sent: 30 May 2002 10:37
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] System.Drawing.dll Exception??

Hi all,

I am still having the same problem, when the control is added
dynamically at runtime each time it is needed. I also ensure that it is
removed from the main form's controls collection and set to null, before
I create the new dialog form.

Any advice at all will be welcomed.

Paul Jefferies



-----Original Message-----
From: Paul Jefferies 
Sent: 29 May 2002 12:59
To: [EMAIL PROTECTED]
Subject: [DOTNET] System.Drawing.dll Exception??

Hi, 

I have a simple C# winforms app, which uses a control developed by one
of my colleagues. 
This control manages the import of data from a csv file to a database.
It declares an interface that the main form implements in order to
provide the customization for the actual task of importing the data. The
problem I am having is when the import is in progress and is then
cancelled (by the use of a button on the control), if I subsequently
create another form (e.g. About dialogbox) I get an exception when
initializing the form - but only if the form has to create a new
System.Drawing.Font (like when a label doesn't have the default font
settings).

The exception message is :
        An unhandled exception of type 'System.ArithmeticException'
occurred in system.drawing.dll
        Additional information: Overflow or underflow in the arithmetic
operation.

Now if the import actually completes, this does not happen. The event to
cancel the import just sets a flag that the import routines checks
before each line is imported, then the control follows the same code
path as if the import reached the end of the input file. 
I have tried resetting the control back to how it was to begin with -
still the same.  

I am at a loss here as to how to chase this problem down. Any pointers
will be greatly appreciated.
Has anyone encountered a problem like this before? 

I know this probably doesn't give you all the info you need, I am more
than happy to provide more detail where needed.

Regads,

Paul Jefferies
Adastra Software Ltd
www.adastra.co.uk

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to