Font change error. So simple but it's driving me crazy! 
Author Message
 Font change error. So simple but it's driving me crazy!

This is so basic but I've searched the web and MSDN for days ....

The following ALWAYS crashes with the following message during debug; ran
into it during my first major rewrite of a VB project (to .NET) and thought
it was me or some other part of my code.  So, I extracted just the basics
and I continue to get:

"An unhandled exception of type 'System.ArithmeticException' occurred in
system.drawing.dll

Additional information: Overflow or underflow in the arithmetic operation."

and points to the "Dim ftype ...." statement in "CloseCheckForm" below.

Note that the same thing occurs (except that it points to the font entry in
the "Windows Forms Designer generated code" section) if I manually change
the font in the design of Button1 in "CloseCheckForm" instead of coding it.

I have reinstalled all of the software this morning and have re-applied the
latest updates to the Framework SDK.

Bob

====================================

Form1 has no modifications in any design properties - it is a form with a
single button.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

         Dim CloseCheckForm As New CloseCheckForm()

         CloseCheckForm.ShowDialog()

     End Sub

 CloseCheckForm has no modifications in any design properties - it is also a
form with a single button.

     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

         Me.Dispose()

     End Sub

     Private Sub CloseCheckForm_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

  --->      Dim ftype As New Font("Arial", 14.25!, FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

              Button1.Font = ftype

     End Sub



Tue, 01 Feb 2005 01:57:35 GMT  
 Font change error. So simple but it's driving me crazy!
Hi Bob,

I tested your code and it run normally on my machine. I know you already
re-installed the software but would you check the System.Drawing.Dll, since
the exception is from that.

--
HuyN - VB .NET team.
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:
> This is so basic but I've searched the web and MSDN for days ....

> The following ALWAYS crashes with the following message during debug; ran
> into it during my first major rewrite of a VB project (to .NET) and
thought
> it was me or some other part of my code.  So, I extracted just the basics
> and I continue to get:

> "An unhandled exception of type 'System.ArithmeticException' occurred in
> system.drawing.dll

> Additional information: Overflow or underflow in the arithmetic
operation."

> and points to the "Dim ftype ...." statement in "CloseCheckForm" below.

> Note that the same thing occurs (except that it points to the font entry
in
> the "Windows Forms Designer generated code" section) if I manually change
> the font in the design of Button1 in "CloseCheckForm" instead of coding
it.

> I have reinstalled all of the software this morning and have re-applied
the
> latest updates to the Framework SDK.

> Bob

> ====================================

> Form1 has no modifications in any design properties - it is a form with a
> single button.

>     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click

>          Dim CloseCheckForm As New CloseCheckForm()

>          CloseCheckForm.ShowDialog()

>      End Sub

>  CloseCheckForm has no modifications in any design properties - it is also
a
> form with a single button.

>      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click

>          Me.Dispose()

>      End Sub

>      Private Sub CloseCheckForm_Load(ByVal sender As System.Object, ByVal
e
> As System.EventArgs) Handles MyBase.Load

>   --->      Dim ftype As New Font("Arial", 14.25!, FontStyle.Bold,
> System.Drawing.GraphicsUnit.Point, CType(0, Byte))

>               Button1.Font = ftype

>      End Sub



Tue, 01 Feb 2005 06:54:48 GMT  
 Font change error. So simple but it's driving me crazy!
Huy,

Thanks for getting back on the problem.  This is a very big issue for me,
obviously.  This is a major project for my company and we need the
additional capability of .NET; I truly do not want to fall back to VB6 if I
can avoid it.

Is there any place on the web to download just that dll or is there any way
to extract just it from the original disk or from the SP 2 file to verify
that it is or is not the problem?

The reason that I removed and reinstalled Visual Studio Pro and Framework
was an attempt to reinstall that dll.

The details on my current dll:

  Size: 462, 848 bytes
  Created: June 12, 2002, 8:55.34
  Version: 1.0.3705.288

I am running XP Pro on a Compaq using an AMD Athlon XP 1900 with few non-MS
apps installed.  The only extra processes running are Iola Macro Magic and
Weather Bug, both of which I've killed during testing to no avail.

I did test the code after the reinstall before I applied SP 2 - no luck.

I have had email contact with someone else that has experienced the problem
so I know that I'm not alone.

Any other ideas?

Bob


Quote:
> Hi Bob,

> I tested your code and it run normally on my machine. I know you already
> re-installed the software but would you check the System.Drawing.Dll,
since
> the exception is from that.
> --
> HuyN - VB .NET team.
> This posting is provided "AS IS" with no warranties, and confers no
rights.


> > This is so basic but I've searched the web and MSDN for days ....

> > The following ALWAYS crashes with the following message during debug;
ran
> > into it during my first major rewrite of a VB project (to .NET) and
> > thought it was me or some other part of my code.  So, I extracted just
the
> > basics and I continue to get:

> > "An unhandled exception of type 'System.ArithmeticException' occurred in
> > system.drawing.dll

> > Additional information: Overflow or underflow in the arithmetic
> > operation."

> > and points to the "Dim ftype ...." statement in "CloseCheckForm" below.

> > Note that the same thing occurs (except that it points to the font entry
> > in the "Windows Forms Designer generated code" section) if I manually
> > change the font in the design of Button1 in "CloseCheckForm" instead of
> > coding it.

> > I have reinstalled all of the software this morning and have re-applied
> > the latest updates to the Framework SDK.

> > Bob

> > ====================================

> > Form1 has no modifications in any design properties - it is a form with
a
> > single button.

> >     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e _
> >    As System.EventArgs) Handles Button1.Click
> >          Dim CloseCheckForm As New CloseCheckForm()
> >          CloseCheckForm.ShowDialog()
> >      End Sub

> >  CloseCheckForm has no modifications in any design properties - it is
also
>  > a form with a single button.

> >      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e _
> >       As System.EventArgs) Handles Button1.Click
> >          Me.Dispose()
> >      End Sub

> >      Private Sub CloseCheckForm_Load(ByVal sender As System.Object, _
> >        ByVal e As System.EventArgs) Handles MyBase.Load
> >   --->      Dim ftype As New Font("Arial", 14.25!, FontStyle.Bold, _
> >               System.Drawing.GraphicsUnit.Point, CType(0, Byte))
> >               Button1.Font = ftype
> >      End Sub



Tue, 01 Feb 2005 22:34:44 GMT  
 Font change error. So simple but it's driving me crazy!
Well, I see that I did not get a response ....  If this problem is what I
think it is, your code could run into some major headaches with customers
using AMD processors.

Just in case any others of you run into this type of problem, here's an ugly
workaround.  I suspect that it is an incompatibility problem between
Microsoft's code in the System Drawing.dll and the AMD Athlon XP's FPU - I
don't have the time nor patience to chase it further.

If any one else has any ideas or other workarounds, please post it.

Use this example and call it in the "load" sequence sub (illustrated) of the
form or dialog that is called from your main form.  Do NOT make any font
changes to any properties in your Design of the called form (I know, more
work in the code and hard to visualize what your developing ....).

    Private Sub CloseCheckForm_Load( _
            ByVal sender As System.Object, _
            ByVal e As System.EventArgs) _
            Handles MyBase.Load

        ' Set the background to something
        Fix_FPU_Problem("Arial", 14, FontStyle.Bold)
    End Sub

#Region " Fix_FPU_Problem"
    ' Function repeats the call to set the font size to avoid an "Arithmetic
Exception" problem if it doesn't work the first time
    Private Function Fix_FPU_Problem( _
            ByVal FF As String, _
            ByVal FSz As Single, _
            ByVal FS As System.Drawing.FontStyle) _
            As Boolean

        ' If we have an error setting the font, try again
        On Error GoTo CorrectFPUError
        Dim ftype As New Font( _
            FF, _
            FSz, _
            FS, _
            System.Drawing.GraphicsUnit.Point, _
            CType(0, Byte))
        GoTo NoError

CorrectFPUError:
        ' If we encounter another error, return "false"
        On Error GoTo CannotCorrect
        ftype = New Font( _
            FF, _
            FSz, _
            FS, _
            System.Drawing.GraphicsUnit.Point, _
            CType(0, Byte))

NoError:
        On Error GoTo 0
        Me.Font = ftype
        Return True
CannotCorrect:
        Return False
    End Function
#End Region
=======================================

For those of you who prefer the "Try/Catch" stuff:

        ' If we have an error setting the font, try again
        Try
            Dim ftype As New Font(FF, FSz, FS, _
                       System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            Me.Font = ftype
            Return True
        Catch x As ArithmeticException
          ' If we encounter another error, return "false"
            Try
                Dim ftype As New Font(FF, FSz, FS, _
                     System.Drawing.GraphicsUnit.Point, CType(0, Byte))
                Me.Font = ftype
                Return True
            Catch x2 As ArithmeticException
                Return False
            End Try
        End Try

======================================

Bob


Quote:
> Huy,

> Thanks for getting back on the problem.  This is a very big issue for me,
> obviously.  This is a major project for my company and we need the
> additional capability of .NET; I truly do not want to fall back to VB6 if
I
> can avoid it.

> Is there any place on the web to download just that dll or is there any
way
> to extract just it from the original disk or from the SP 2 file to verify
> that it is or is not the problem?

> The reason that I removed and reinstalled Visual Studio Pro and Framework
> was an attempt to reinstall that dll.

> The details on my current dll:

>   Size: 462, 848 bytes
>   Created: June 12, 2002, 8:55.34
>   Version: 1.0.3705.288

> I am running XP Pro on a Compaq using an AMD Athlon XP 1900 with few
non-MS
> apps installed.  The only extra processes running are Iola Macro Magic and
> Weather Bug, both of which I've killed during testing to no avail.

> I did test the code after the reinstall before I applied SP 2 - no luck.

> I have had email contact with someone else that has experienced the
problem
> so I know that I'm not alone.

> Any other ideas?

> Bob


> > Hi Bob,

> > I tested your code and it run normally on my machine. I know you already
> > re-installed the software but would you check the System.Drawing.Dll,
> since
> > the exception is from that.
> > --
> > HuyN - VB .NET team.
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.


> > > This is so basic but I've searched the web and MSDN for days ....

> > > The following ALWAYS crashes with the following message during debug;
> ran
> > > into it during my first major rewrite of a VB project (to .NET) and
> > > thought it was me or some other part of my code.  So, I extracted just
> the
> > > basics and I continue to get:

> > > "An unhandled exception of type 'System.ArithmeticException' occurred
in
> > > system.drawing.dll

> > > Additional information: Overflow or underflow in the arithmetic
> > > operation."

> > > and points to the "Dim ftype ...." statement in "CloseCheckForm"
below.

> > > Note that the same thing occurs (except that it points to the font
entry
> > > in the "Windows Forms Designer generated code" section) if I manually
> > > change the font in the design of Button1 in "CloseCheckForm" instead
of
> > > coding it.

> > > I have reinstalled all of the software this morning and have
re-applied
> > > the latest updates to the Framework SDK.

> > > Bob

> > > ====================================

> > > Form1 has no modifications in any design properties - it is a form
with
> a
> > > single button.

> > >     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e _
> > >    As System.EventArgs) Handles Button1.Click
> > >          Dim CloseCheckForm As New CloseCheckForm()
> > >          CloseCheckForm.ShowDialog()
> > >      End Sub

> > >  CloseCheckForm has no modifications in any design properties - it is
> also
> >  > a form with a single button.

> > >      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
_
> > >       As System.EventArgs) Handles Button1.Click
> > >          Me.Dispose()
> > >      End Sub

> > >      Private Sub CloseCheckForm_Load(ByVal sender As System.Object, _
> > >        ByVal e As System.EventArgs) Handles MyBase.Load
> > >   --->      Dim ftype As New Font("Arial", 14.25!, FontStyle.Bold, _
> > >               System.Drawing.GraphicsUnit.Point, CType(0, Byte))
> > >               Button1.Font = ftype
> > >      End Sub



Fri, 04 Feb 2005 02:09:29 GMT  
 Font change error. So simple but it's driving me crazy!
FYI, I was unable to duplicate this on an AMD system.

HTH

David


Quote:
> Well, I see that I did not get a response ....  If this problem is what I
> think it is, your code could run into some major headaches with customers
> using AMD processors.

> Just in case any others of you run into this type of problem, here's an
ugly
> workaround.  I suspect that it is an incompatibility problem between
> Microsoft's code in the System Drawing.dll and the AMD Athlon XP's FPU - I
> don't have the time nor patience to chase it further.

> If any one else has any ideas or other workarounds, please post it.

> Use this example and call it in the "load" sequence sub (illustrated) of
the
> form or dialog that is called from your main form.  Do NOT make any font
> changes to any properties in your Design of the called form (I know, more
> work in the code and hard to visualize what your developing ....).

>     Private Sub CloseCheckForm_Load( _
>             ByVal sender As System.Object, _
>             ByVal e As System.EventArgs) _
>             Handles MyBase.Load

>         ' Set the background to something
>         Fix_FPU_Problem("Arial", 14, FontStyle.Bold)
>     End Sub

> #Region " Fix_FPU_Problem"
>     ' Function repeats the call to set the font size to avoid an
"Arithmetic
> Exception" problem if it doesn't work the first time
>     Private Function Fix_FPU_Problem( _
>             ByVal FF As String, _
>             ByVal FSz As Single, _
>             ByVal FS As System.Drawing.FontStyle) _
>             As Boolean

>         ' If we have an error setting the font, try again
>         On Error GoTo CorrectFPUError
>         Dim ftype As New Font( _
>             FF, _
>             FSz, _
>             FS, _
>             System.Drawing.GraphicsUnit.Point, _
>             CType(0, Byte))
>         GoTo NoError

> CorrectFPUError:
>         ' If we encounter another error, return "false"
>         On Error GoTo CannotCorrect
>         ftype = New Font( _
>             FF, _
>             FSz, _
>             FS, _
>             System.Drawing.GraphicsUnit.Point, _
>             CType(0, Byte))

> NoError:
>         On Error GoTo 0
>         Me.Font = ftype
>         Return True
> CannotCorrect:
>         Return False
>     End Function
> #End Region
> =======================================

> For those of you who prefer the "Try/Catch" stuff:

>         ' If we have an error setting the font, try again
>         Try
>             Dim ftype As New Font(FF, FSz, FS, _
>                        System.Drawing.GraphicsUnit.Point, CType(0, Byte))
>             Me.Font = ftype
>             Return True
>         Catch x As ArithmeticException
>           ' If we encounter another error, return "false"
>             Try
>                 Dim ftype As New Font(FF, FSz, FS, _
>                      System.Drawing.GraphicsUnit.Point, CType(0, Byte))
>                 Me.Font = ftype
>                 Return True
>             Catch x2 As ArithmeticException
>                 Return False
>             End Try
>         End Try

> ======================================

> Bob



> > Huy,

> > Thanks for getting back on the problem.  This is a very big issue for
me,
> > obviously.  This is a major project for my company and we need the
> > additional capability of .NET; I truly do not want to fall back to VB6
if
> I
> > can avoid it.

> > Is there any place on the web to download just that dll or is there any
> way
> > to extract just it from the original disk or from the SP 2 file to
verify
> > that it is or is not the problem?

> > The reason that I removed and reinstalled Visual Studio Pro and
Framework
> > was an attempt to reinstall that dll.

> > The details on my current dll:

> >   Size: 462, 848 bytes
> >   Created: June 12, 2002, 8:55.34
> >   Version: 1.0.3705.288

> > I am running XP Pro on a Compaq using an AMD Athlon XP 1900 with few
> non-MS
> > apps installed.  The only extra processes running are Iola Macro Magic
and
> > Weather Bug, both of which I've killed during testing to no avail.

> > I did test the code after the reinstall before I applied SP 2 - no luck.

> > I have had email contact with someone else that has experienced the
> problem
> > so I know that I'm not alone.

> > Any other ideas?

> > Bob


> > > Hi Bob,

> > > I tested your code and it run normally on my machine. I know you
already
> > > re-installed the software but would you check the System.Drawing.Dll,
> > since
> > > the exception is from that.
> > > --
> > > HuyN - VB .NET team.
> > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.


> > > > This is so basic but I've searched the web and MSDN for days ....

> > > > The following ALWAYS crashes with the following message during
debug;
> > ran
> > > > into it during my first major rewrite of a VB project (to .NET) and
> > > > thought it was me or some other part of my code.  So, I extracted
just
> > the
> > > > basics and I continue to get:

> > > > "An unhandled exception of type 'System.ArithmeticException'
occurred
> in
> > > > system.drawing.dll

> > > > Additional information: Overflow or underflow in the arithmetic
> > > > operation."

> > > > and points to the "Dim ftype ...." statement in "CloseCheckForm"
> below.

> > > > Note that the same thing occurs (except that it points to the font
> entry
> > > > in the "Windows Forms Designer generated code" section) if I
manually
> > > > change the font in the design of Button1 in "CloseCheckForm" instead
> of
> > > > coding it.

> > > > I have reinstalled all of the software this morning and have
> re-applied
> > > > the latest updates to the Framework SDK.

> > > > Bob

> > > > ====================================

> > > > Form1 has no modifications in any design properties - it is a form
> with
> > a
> > > > single button.

> > > >     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
_
> > > >    As System.EventArgs) Handles Button1.Click
> > > >          Dim CloseCheckForm As New CloseCheckForm()
> > > >          CloseCheckForm.ShowDialog()
> > > >      End Sub

> > > >  CloseCheckForm has no modifications in any design properties - it
is
> > also
> > >  > a form with a single button.

> > > >      Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e
> _
> > > >       As System.EventArgs) Handles Button1.Click
> > > >          Me.Dispose()
> > > >      End Sub

> > > >      Private Sub CloseCheckForm_Load(ByVal sender As System.Object,
_
> > > >        ByVal e As System.EventArgs) Handles MyBase.Load
> > > >   --->      Dim ftype As New Font("Arial", 14.25!, FontStyle.Bold, _
> > > >               System.Drawing.GraphicsUnit.Point, CType(0, Byte))
> > > >               Button1.Font = ftype
> > > >      End Sub



Fri, 04 Feb 2005 09:35:19 GMT  
 Font change error. So simple but it's driving me crazy!
David,

Thanks for the info.  Also heard from someone who HAS the problem but is
running on Intel machines.

Bob

Quote:
> FYI, I was unable to duplicate this on an AMD system.

> HTH

> David



> > Well, I see that I did not get a response ....  If this problem is what
I
> > think it is, your code could run into some major headaches with
customers
> > using AMD processors.

> > Just in case any others of you run into this type of problem, here's an
> ugly
> > workaround.  I suspect that it is an incompatibility problem between
> > Microsoft's code in the System Drawing.dll and the AMD Athlon XP's FPU -
I
> > don't have the time nor patience to chase it further.

> > If any one else has any ideas or other workarounds, please post it.

> > Use this example and call it in the "load" sequence sub (illustrated) of
> the
> > form or dialog that is called from your main form.  Do NOT make any font
> > changes to any properties in your Design of the called form (I know,
more
> > work in the code and hard to visualize what your developing ....).

> >     Private Sub CloseCheckForm_Load( _
> >             ByVal sender As System.Object, _
> >             ByVal e As System.EventArgs) _
> >             Handles MyBase.Load

> >         ' Set the background to something
> >         Fix_FPU_Problem("Arial", 14, FontStyle.Bold)
> >     End Sub

> > #Region " Fix_FPU_Problem"
> >     ' Function repeats the call to set the font size to avoid an
> "Arithmetic
> > Exception" problem if it doesn't work the first time
> >     Private Function Fix_FPU_Problem( _
> >             ByVal FF As String, _
> >             ByVal FSz As Single, _
> >             ByVal FS As System.Drawing.FontStyle) _
> >             As Boolean

> >         ' If we have an error setting the font, try again
> >         On Error GoTo CorrectFPUError
> >         Dim ftype As New Font( _
> >             FF, _
> >             FSz, _
> >             FS, _
> >             System.Drawing.GraphicsUnit.Point, _
> >             CType(0, Byte))
> >         GoTo NoError

> > CorrectFPUError:
> >         ' If we encounter another error, return "false"
> >         On Error GoTo CannotCorrect
> >         ftype = New Font( _
> >             FF, _
> >             FSz, _
> >             FS, _
> >             System.Drawing.GraphicsUnit.Point, _
> >             CType(0, Byte))

> > NoError:
> >         On Error GoTo 0
> >         Me.Font = ftype
> >         Return True
> > CannotCorrect:
> >         Return False
> >     End Function
> > #End Region
> > =======================================

> > For those of you who prefer the "Try/Catch" stuff:

> >         ' If we have an error setting the font, try again
> >         Try
> >             Dim ftype As New Font(FF, FSz, FS, _
> >                        System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
> >             Me.Font = ftype
> >             Return True
> >         Catch x As ArithmeticException
> >           ' If we encounter another error, return "false"
> >             Try
> >                 Dim ftype As New Font(FF, FSz, FS, _
> >                      System.Drawing.GraphicsUnit.Point, CType(0, Byte))
> >                 Me.Font = ftype
> >                 Return True
> >             Catch x2 As ArithmeticException
> >                 Return False
> >             End Try
> >         End Try

> > ======================================

> > Bob



> > > Huy,

> > > Thanks for getting back on the problem.  This is a very big issue for
> me,
> > > obviously.  This is a major project for my company and we need the
> > > additional capability of .NET; I truly do not want to fall back to VB6
> if
> > I
> > > can avoid it.

> > > Is there any place on the web to download just that dll or is there
any
> > way
> > > to extract just it from the original disk or from the SP 2 file to
> verify
> > > that it is or is not the problem?

> > > The reason that I removed and reinstalled Visual Studio Pro and
> Framework
> > > was an attempt to reinstall that dll.

> > > The details on my current dll:

> > >   Size: 462, 848 bytes
> > >   Created: June 12, 2002, 8:55.34
> > >   Version: 1.0.3705.288

> > > I am running XP Pro on a Compaq using an AMD Athlon XP 1900 with few
> > non-MS
> > > apps installed.  The only extra processes running are Iola Macro Magic
> and
> > > Weather Bug, both of which I've killed during testing to no avail.

> > > I did test the code after the reinstall before I applied SP 2 - no
luck.

> > > I have had email contact with someone else that has experienced the
> > problem
> > > so I know that I'm not alone.

> > > Any other ideas?

> > > Bob


> > > > Hi Bob,

> > > > I tested your code and it run normally on my machine. I know you
> already
> > > > re-installed the software but would you check the
System.Drawing.Dll,
> > > since
> > > > the exception is from that.
> > > > --
> > > > HuyN - VB .NET team.
> > > > This posting is provided "AS IS" with no warranties, and confers no
> > > rights.


> > > > > This is so basic but I've searched the web and MSDN for days ....

> > > > > The following ALWAYS crashes with the following message during
> debug;
> > > ran
> > > > > into it during my first major rewrite of a VB project (to .NET)
and
> > > > > thought it was me or some other part of my code.  So, I extracted
> just
> > > the
> > > > > basics and I continue to get:

> > > > > "An unhandled exception of type 'System.ArithmeticException'
> occurred
> > in
> > > > > system.drawing.dll

> > > > > Additional information: Overflow or underflow in the arithmetic
> > > > > operation."

> > > > > and points to the "Dim ftype ...." statement in "CloseCheckForm"
> > below.

> > > > > Note that the same thing occurs (except that it points to the font
> > entry
> > > > > in the "Windows Forms Designer generated code" section) if I
> manually
> > > > > change the font in the design of Button1 in "CloseCheckForm"
instead
> > of
> > > > > coding it.

> > > > > I have reinstalled all of the software this morning and have
> > re-applied
> > > > > the latest updates to the Framework SDK.

> > > > > Bob

> > > > > ====================================

> > > > > Form1 has no modifications in any design properties - it is a form
> > with
> > > a
> > > > > single button.

> > > > >     Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e
> _
> > > > >    As System.EventArgs) Handles Button1.Click
> > > > >          Dim CloseCheckForm As New CloseCheckForm()
> > > > >          CloseCheckForm.ShowDialog()
> > > > >      End Sub

> > > > >  CloseCheckForm has no modifications in any design properties - it
> is
> > > also
> > > >  > a form with a single button.

> > > > >      Private Sub Button1_Click(ByVal sender As System.Object,
ByVal
> e
> > _
> > > > >       As System.EventArgs) Handles Button1.Click
> > > > >          Me.Dispose()
> > > > >      End Sub

> > > > >      Private Sub CloseCheckForm_Load(ByVal sender As
System.Object,
> _
> > > > >        ByVal e As System.EventArgs) Handles MyBase.Load
> > > > >   --->      Dim ftype As New Font("Arial", 14.25!, FontStyle.Bold,
_
> > > > >               System.Drawing.GraphicsUnit.Point, CType(0, Byte))
> > > > >               Button1.Font = ftype
> > > > >      End Sub



Fri, 04 Feb 2005 21:15:54 GMT  
 Font change error. So simple but it's driving me crazy!
Hi Bob, sorry for the late reply, but I've tried searching for your problem,
and the best thing I came up with is
FPU exceptions are enabled, which you already got. I'm still waiting for
some answers.

I'll post more if I get the answers.

Thanks.

--
HuyN - VB .NET team.
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:
> David,

> Thanks for the info.  Also heard from someone who HAS the problem but is
> running on Intel machines.

> Bob


> > FYI, I was unable to duplicate this on an AMD system.

> > HTH

> > David



> > > Well, I see that I did not get a response ....  If this problem is
what
> I
> > > think it is, your code could run into some major headaches with
> customers
> > > using AMD processors.

> > > Just in case any others of you run into this type of problem, here's
an
> > ugly
> > > workaround.  I suspect that it is an incompatibility problem between
> > > Microsoft's code in the System Drawing.dll and the AMD Athlon XP's
FPU -
> I
> > > don't have the time nor patience to chase it further.

> > > If any one else has any ideas or other workarounds, please post it.

> > > Use this example and call it in the "load" sequence sub (illustrated)
of
> > the
> > > form or dialog that is called from your main form.  Do NOT make any
font
> > > changes to any properties in your Design of the called form (I know,
> more
> > > work in the code and hard to visualize what your developing ....).

> > >     Private Sub CloseCheckForm_Load( _
> > >             ByVal sender As System.Object, _
> > >             ByVal e As System.EventArgs) _
> > >             Handles MyBase.Load

> > >         ' Set the background to something
> > >         Fix_FPU_Problem("Arial", 14, FontStyle.Bold)
> > >     End Sub

> > > #Region " Fix_FPU_Problem"
> > >     ' Function repeats the call to set the font size to avoid an
> > "Arithmetic
> > > Exception" problem if it doesn't work the first time
> > >     Private Function Fix_FPU_Problem( _
> > >             ByVal FF As String, _
> > >             ByVal FSz As Single, _
> > >             ByVal FS As System.Drawing.FontStyle) _
> > >             As Boolean

> > >         ' If we have an error setting the font, try again
> > >         On Error GoTo CorrectFPUError
> > >         Dim ftype As New Font( _
> > >             FF, _
> > >             FSz, _
> > >             FS, _
> > >             System.Drawing.GraphicsUnit.Point, _
> > >             CType(0, Byte))
> > >         GoTo NoError

> > > CorrectFPUError:
> > >         ' If we encounter another error, return "false"
> > >         On Error GoTo CannotCorrect
> > >         ftype = New Font( _
> > >             FF, _
> > >             FSz, _
> > >             FS, _
> > >             System.Drawing.GraphicsUnit.Point, _
> > >             CType(0, Byte))

> > > NoError:
> > >         On Error GoTo 0
> > >         Me.Font = ftype
> > >         Return True
> > > CannotCorrect:
> > >         Return False
> > >     End Function
> > > #End Region
> > > =======================================

> > > For those of you who prefer the "Try/Catch" stuff:

> > >         ' If we have an error setting the font, try again
> > >         Try
> > >             Dim ftype As New Font(FF, FSz, FS, _
> > >                        System.Drawing.GraphicsUnit.Point, CType(0,
> Byte))
> > >             Me.Font = ftype
> > >             Return True
> > >         Catch x As ArithmeticException
> > >           ' If we encounter another error, return "false"
> > >             Try
> > >                 Dim ftype As New Font(FF, FSz, FS, _
> > >                      System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
> > >                 Me.Font = ftype
> > >                 Return True
> > >             Catch x2 As ArithmeticException
> > >                 Return False
> > >             End Try
> > >         End Try

> > > ======================================

> > > Bob



> > > > Huy,

> > > > Thanks for getting back on the problem.  This is a very big issue
for
> > me,
> > > > obviously.  This is a major project for my company and we need the
> > > > additional capability of .NET; I truly do not want to fall back to
VB6
> > if
> > > I
> > > > can avoid it.

> > > > Is there any place on the web to download just that dll or is there
> any
> > > way
> > > > to extract just it from the original disk or from the SP 2 file to
> > verify
> > > > that it is or is not the problem?

> > > > The reason that I removed and reinstalled Visual Studio Pro and
> > Framework
> > > > was an attempt to reinstall that dll.

> > > > The details on my current dll:

> > > >   Size: 462, 848 bytes
> > > >   Created: June 12, 2002, 8:55.34
> > > >   Version: 1.0.3705.288

> > > > I am running XP Pro on a Compaq using an AMD Athlon XP 1900 with few
> > > non-MS
> > > > apps installed.  The only extra processes running are Iola Macro
Magic
> > and
> > > > Weather Bug, both of which I've killed during testing to no avail.

> > > > I did test the code after the reinstall before I applied SP 2 - no
> luck.

> > > > I have had email contact with someone else that has experienced the
> > > problem
> > > > so I know that I'm not alone.

> > > > Any other ideas?

> > > > Bob


> > > > > Hi Bob,

> > > > > I tested your code and it run normally on my machine. I know you
> > already
> > > > > re-installed the software but would you check the
> System.Drawing.Dll,
> > > > since
> > > > > the exception is from that.
> > > > > --
> > > > > HuyN - VB .NET team.
> > > > > This posting is provided "AS IS" with no warranties, and confers
no
> > > > rights.


> > > > > > This is so basic but I've searched the web and MSDN for days
....

> > > > > > The following ALWAYS crashes with the following message during
> > debug;
> > > > ran
> > > > > > into it during my first major rewrite of a VB project (to .NET)
> and
> > > > > > thought it was me or some other part of my code.  So, I
extracted
> > just
> > > > the
> > > > > > basics and I continue to get:

> > > > > > "An unhandled exception of type 'System.ArithmeticException'
> > occurred
> > > in
> > > > > > system.drawing.dll

> > > > > > Additional information: Overflow or underflow in the arithmetic
> > > > > > operation."

> > > > > > and points to the "Dim ftype ...." statement in "CloseCheckForm"
> > > below.

> > > > > > Note that the same thing occurs (except that it points to the
font
> > > entry
> > > > > > in the "Windows Forms Designer generated code" section) if I
> > manually
> > > > > > change the font in the design of Button1 in "CloseCheckForm"
> instead
> > > of
> > > > > > coding it.

> > > > > > I have reinstalled all of the software this morning and have
> > > re-applied
> > > > > > the latest updates to the Framework SDK.

> > > > > > Bob

> > > > > > ====================================

> > > > > > Form1 has no modifications in any design properties - it is a
form
> > > with
> > > > a
> > > > > > single button.

> > > > > >     Private Sub Button1_Click(ByVal sender As System.Object,
ByVal
> e
> > _
> > > > > >    As System.EventArgs) Handles Button1.Click
> > > > > >          Dim CloseCheckForm As New CloseCheckForm()
> > > > > >          CloseCheckForm.ShowDialog()
> > > > > >      End Sub

> > > > > >  CloseCheckForm has no modifications in any design properties -
it
> > is
> > > > also
> > > > >  > a form with a single button.

> > > > > >      Private Sub Button1_Click(ByVal sender As System.Object,
> ByVal
> > e
> > > _
> > > > > >       As System.EventArgs) Handles Button1.Click
> > > > > >          Me.Dispose()
> > > > > >      End Sub

> > > > > >      Private Sub CloseCheckForm_Load(ByVal sender As
> System.Object,
> > _
> > > > > >        ByVal e As System.EventArgs) Handles MyBase.Load
> > > > > >   --->      Dim ftype As New Font("Arial", 14.25!,
FontStyle.Bold,
> _
> > > > > >               System.Drawing.GraphicsUnit.Point, CType(0, Byte))
> > > > > >               Button1.Font = ftype
> > > > > >      End Sub



Sat, 05 Feb 2005 00:34:52 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. NewBe Question, Probably simple but driving me CRAZY!!!

2. Drive letter driving me crazy!

3. (VBScript) How to change the Font of simple node in TreeView

4. change label's font's script in runtime

5. Error '372' driving me insane

6. Simple 'AppActivate' Error-trapping Question

7. DAO is driving me crazy

8. sql / vba driving me crazy!

9. sql /VBA driving me crazy!

10. The syntax in Access is driving me crazy.

11. HELP a form is driving me crazy!!!

12. Database Query - Driving me crazy!

 

 
Powered by phpBB® Forum Software